public class DiscreteNaiveBayesTrainer extends SingleLabelDatasetTrainer<DiscreteNaiveBayesModel>
setPriorProbabilities
or withEquiprobableClasses
. If
equiprobableClasses
is set, the probalilities of all classes will be 1/k
, where k
is classes
count. Also, the trainer converts feature to discrete values by using bucketThresholds
.DatasetTrainer.EmptyDatasetException
envBuilder, environment
Constructor and Description |
---|
DiscreteNaiveBayesTrainer() |
Modifier and Type | Method and Description |
---|---|
<K,V> DiscreteNaiveBayesModel |
fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder,
Preprocessor<K,V> extractor)
Trains model based on the specified data.
|
boolean |
isUpdateable(DiscreteNaiveBayesModel mdl) |
DiscreteNaiveBayesTrainer |
resetProbabilitiesSettings()
Sets default settings
equiprobableClasses to false and removes priorProbabilities. |
DiscreteNaiveBayesTrainer |
setBucketThresholds(double[][] bucketThresholds)
Sets buckest borders.
|
DiscreteNaiveBayesTrainer |
setPriorProbabilities(double[] priorProbabilities)
Sets prior probabilities.
|
protected <K,V> DiscreteNaiveBayesModel |
updateModel(DiscreteNaiveBayesModel mdl,
DatasetBuilder<K,V> datasetBuilder,
Preprocessor<K,V> extractor)
Trains new model taken previous one as a first approximation.
|
DiscreteNaiveBayesTrainer |
withEquiprobableClasses()
Sets equal probability for all classes.
|
fit, fit, fit, fit, fit, fit, getLastTrainedModelOrThrowEmptyDatasetException, identityTrainer, learningEnvironment, update, update, update, update, update, withConvertedLabels, withEnvironmentBuilder
public <K,V> DiscreteNaiveBayesModel fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> extractor)
fitWithInitializedDeployingContext
in class DatasetTrainer<DiscreteNaiveBayesModel,Double>
K
- Type of a key in upstream
data.V
- Type of a value in upstream
data.datasetBuilder
- Dataset builder.extractor
- Extractor of UpstreamEntry
into LabeledVector
.public boolean isUpdateable(DiscreteNaiveBayesModel mdl)
isUpdateable
in class DatasetTrainer<DiscreteNaiveBayesModel,Double>
mdl
- Model.protected <K,V> DiscreteNaiveBayesModel updateModel(DiscreteNaiveBayesModel mdl, DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> extractor)
updateModel
in class DatasetTrainer<DiscreteNaiveBayesModel,Double>
K
- Type of a key in upstream
data.V
- Type of a value in upstream
data.mdl
- Learned model.datasetBuilder
- Dataset builder.extractor
- Extractor of UpstreamEntry
into LabeledVector
.public DiscreteNaiveBayesTrainer withEquiprobableClasses()
public DiscreteNaiveBayesTrainer setPriorProbabilities(double[] priorProbabilities)
public DiscreteNaiveBayesTrainer setBucketThresholds(double[][] bucketThresholds)
public DiscreteNaiveBayesTrainer resetProbabilitiesSettings()
equiprobableClasses
to false
and removes priorProbabilities.
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024