public abstract class BayesianModel extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
BayesianModel.OptimizerType
optimizer types that can be used with the bayesian models.
|
Modifier and Type | Method and Description |
---|---|
abstract double |
evaluate(double[] features,
Object expected) |
double |
getLearningRate() |
int |
getNumFeatures() |
int |
getNumSamples() |
BayesianModel.OptimizerType |
getOptimizerType() |
protected abstract double[][] |
getUpdatedWeights()
implements the model specific gradient updates.
|
void |
initiateModel()
construct the model.
|
Double |
predict(double[] features)
predict the target according to given features.
|
Double[] |
predictWithStd(double[] features)
predict the target according to given features.
|
void |
setAddBias(boolean val) |
void |
setLearningRate(double val) |
void |
setNumFeatures(int val) |
void |
setNumSamples(int val) |
void |
setOptimizerType(BayesianModel.OptimizerType val) |
void |
setPredictionSamples(int val) |
double[] |
update(double[] features,
double[] target)
train the model.
|
public void initiateModel()
public double[] update(double[] features, double[] target)
features
- feature vectortarget
- target/label
for regression target should be a real vector
for binary classification target should be a vector with labels (0 or 1)
multiclass classification expects one-hot embedded matrix or a vector with label indexespublic Double predict(double[] features)
uses 1000 (default) samples to estimate the predictive distribution
features
- feature vectorpublic Double[] predictWithStd(double[] features)
uses 1000 (default) samples to estimate the predictive distribution
features
- feature vectorprotected abstract double[][] getUpdatedWeights()
public abstract double evaluate(double[] features, Object expected)
public void setAddBias(boolean val)
public int getNumFeatures()
public void setNumFeatures(int val)
public int getNumSamples()
public void setNumSamples(int val)
public BayesianModel.OptimizerType getOptimizerType()
public void setOptimizerType(BayesianModel.OptimizerType val)
public double getLearningRate()
public void setLearningRate(double val)
public void setPredictionSamples(int val)
Copyright © 2019 WSO2. All rights reserved.