public class NaiveBayes extends Object implements Classifier, Parameterized
Gaussian
distribution, and becomes Gaussian Naive Bayes. Other distributions are
supported, and a KernelDensityEstimator
can be used as well.
setSparceInput(boolean)
Modifier and Type | Class and Description |
---|---|
static class |
NaiveBayes.NumericalHandeling
There are multiple ways of handling numerical attributes.
|
Modifier and Type | Field and Description |
---|---|
static NaiveBayes.NumericalHandeling |
defaultHandling
The default method of handling numeric attributes is
NaiveBayes.NumericalHandeling.NORMAL . |
Constructor and Description |
---|
NaiveBayes()
Creates a new Gaussian Naive Bayes classifier
|
NaiveBayes(NaiveBayes.NumericalHandeling numericalHandling)
Creates a new Naive Bayes classifier that uses the specific method for
handling numeric features.
|
Modifier and Type | Method and Description |
---|---|
CategoricalResults |
classify(DataPoint data)
Performs classification on the given data point.
|
Classifier |
clone() |
NaiveBayes.NumericalHandeling |
getNumericalHandling()
Returns the method used to handle numerical attributes
|
Parameter |
getParameter(String paramName)
Returns the parameter with the given name.
|
List<Parameter> |
getParameters()
Returns the list of parameters that can be altered for this learner.
|
boolean |
isSparceInput()
Returns true if the Classifier assumes that data points are sparce.
|
void |
setNumericalHandling(NaiveBayes.NumericalHandeling numericalHandling)
Sets the method used by this instance for handling numerical attributes.
|
void |
setSparceInput(boolean sparceInput)
Tells the Naive Bayes classifier to
assume the importance of sparseness
in the numerical values.
|
boolean |
supportsWeightedData()
Indicates whether the model knows how to train using weighted data points.
|
void |
trainC(ClassificationDataSet dataSet)
Trains the classifier and constructs a model for classification using the
given data set.
|
void |
trainC(ClassificationDataSet dataSet,
ExecutorService threadPool)
Trains the classifier and constructs a model for classification using the
given data set.
|
public static final NaiveBayes.NumericalHandeling defaultHandling
NaiveBayes.NumericalHandeling.NORMAL
.public NaiveBayes(NaiveBayes.NumericalHandeling numericalHandling)
numericalHandling
- the method to use for numeric featurespublic NaiveBayes()
public void setNumericalHandling(NaiveBayes.NumericalHandeling numericalHandling)
numericalHandling
- the method to use for numerical attributespublic NaiveBayes.NumericalHandeling getNumericalHandling()
public boolean isSparceInput()
setSparceInput(boolean)
public void setSparceInput(boolean sparceInput)
sparceInput
- true to assume sparseness in the data, false to ignore it and assume zeros are meaningful values.isSparceInput()
public CategoricalResults classify(DataPoint data)
Classifier
classify
in interface Classifier
data
- the data point to classifypublic void trainC(ClassificationDataSet dataSet)
Classifier
trainC
in interface Classifier
dataSet
- the data set to train onpublic List<Parameter> getParameters()
Parameterized
getParameters
in interface Parameterized
public Parameter getParameter(String paramName)
Parameterized
getParameter
in interface Parameterized
paramName
- the name of the parameter to obtainpublic Classifier clone()
clone
in interface Classifier
clone
in class Object
public boolean supportsWeightedData()
Classifier
supportsWeightedData
in interface Classifier
public void trainC(ClassificationDataSet dataSet, ExecutorService threadPool)
Classifier
trainC
in interface Classifier
dataSet
- the data set to train onthreadPool
- the source of threads to use.Copyright © 2017. All rights reserved.