jsat.classifiers.bayesian
Class BestClassDistribution
- java.lang.Object
-
- jsat.classifiers.bayesian.BestClassDistribution
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Classifier, Parameterized
- Direct Known Subclasses:
- MultivariateNormals
public class BestClassDistribution extends java.lang.Object implements Classifier, Parameterized
BestClassDistribution is a generic class for performing classification by fitting aMultivariateDistributionto each class. The distribution is supplied by the user, and each class if fit to the same type of distribution. Classification is then performed by returning the class of the most likely distribution given the data point.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static booleanUSE_PRIORSThe default value for whether or not to use the prior probability of a class when making classification decisions is true.
-
Constructor Summary
Constructors Constructor and Description BestClassDistribution(BestClassDistribution toCopy)Copy constructorBestClassDistribution(MultivariateDistribution baseDist)BestClassDistribution(MultivariateDistribution baseDist, boolean usePriors)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description CategoricalResultsclassify(DataPoint data)Performs classification on the given data point.BestClassDistributionclone()booleanisUsePriors()Returns whether or not this object uses the prior probabilities for classification.voidsetUsePriors(boolean usePriors)Controls whether or not the priors will be used for classification.booleansupportsWeightedData()Indicates whether the model knows how to train using weighted data points.voidtrain(ClassificationDataSet dataSet, boolean parallel)Trains the classifier and constructs a model for classification using the given data set.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.classifiers.Classifier
train
-
Methods inherited from interface jsat.parameters.Parameterized
getParameter, getParameters
-
-
-
-
Field Detail
-
USE_PRIORS
public static final boolean USE_PRIORS
The default value for whether or not to use the prior probability of a class when making classification decisions is true.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BestClassDistribution
public BestClassDistribution(MultivariateDistribution baseDist)
-
BestClassDistribution
public BestClassDistribution(MultivariateDistribution baseDist, boolean usePriors)
-
BestClassDistribution
public BestClassDistribution(BestClassDistribution toCopy)
Copy constructor- Parameters:
toCopy- the object to copy
-
-
Method Detail
-
setUsePriors
public void setUsePriors(boolean usePriors)
Controls whether or not the priors will be used for classification. This value can be changed at any time, before or after training has occurred.- Parameters:
usePriors- true to use the prior probabilities for each class, false to ignore them.
-
isUsePriors
public boolean isUsePriors()
Returns whether or not this object uses the prior probabilities for classification.- Returns:
trueif the prior probabilities are being used,falseif not.
-
classify
public CategoricalResults classify(DataPoint data)
Description copied from interface:ClassifierPerforms classification on the given data point.- Specified by:
classifyin interfaceClassifier- Parameters:
data- the data point to classify- Returns:
- the results of the classification.
-
train
public void train(ClassificationDataSet dataSet, boolean parallel)
Description copied from interface:ClassifierTrains the classifier and constructs a model for classification using the given data set. If the training method knows how, it will used the threadPool to conduct training in parallel. This method will block until the training has completed.- Specified by:
trainin interfaceClassifier- Parameters:
dataSet- the data set to train onparallel-trueif multiple threads should be used to train the model.falseif it should be done in a single threaded manner.
-
supportsWeightedData
public boolean supportsWeightedData()
Description copied from interface:ClassifierIndicates whether the model knows how to train using weighted data points. If it does, the model will train assuming the weights. The values returned by this method may change depending on the parameters set for the model.- Specified by:
supportsWeightedDatain interfaceClassifier- Returns:
- true if the model supports weighted data, false otherwise
-
clone
public BestClassDistribution clone()
- Specified by:
clonein interfaceClassifier- Overrides:
clonein classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG