Algorithms
GaussianNB
The GaussianNB algorithm uses the scikit-learn GaussianNB estimator to fit a model to predict the value of categorical fields, where the likelihood of explanatory variables is assumed to be Gaussian. GaussianNB is an implementation of Ga…
The GaussianNB algorithm uses the scikit-learn GaussianNB estimator to fit a model to predict the value of categorical fields, where the likelihood of explanatory variables is assumed to be Gaussian. GaussianNB is an implementation of Gaussian Naive Bayes classification algorithm. This algorithm supports incremental fit.
Parameters
- The
partial_fitparameter controls whether an existing model should be incrementally updated or not. This allows you to update an existing model using only new data without having to retrain it on the full training data set. - The
partial_fitparameter default is False.
Syntax
fit GaussianNB <field_to_predict> from <explanatory_fields> [into <model name>] [partial_fit=<true|false>]
You can save GaussianNB models using the into keyword and apply the saved model later to new data using the apply command.
... | apply TESTMODEL_GaussianNB
You can inspect models learned by GaussianNB with the summary command.
... | summary My_Incremental_Model
Syntax constraints
- If
My_Incremental_Modeldoes not exist, the command saves the model data under the model nameMy_Incremental_Model. IfMy_Incremental_Modelexists and was trained using GaussianNB, the command updates the existing model with the new input. IfMy_Incremental_Modelexists but was not trained by GaussianNB, an error message is thrown. - If
partial_fit=Falseorpartial_fitis not specified the model specified is created and replaces the pre-trained model if one exists.
Example
The following example uses GaussianNB on a test set.
... | fit GaussianNB species from * into TESTMODEL_GaussianNB
The following example includes the partial_fit command.
| inputlookup iris.csv | fit GaussianNB species from * partial_fit=true into My_Incremental_Model
Local availability Permalink to this section
- Local class:
GaussianNB - Source file:
Splunk_ML_Toolkit/bin/algos/GaussianNB.py(in-repo pathSplunk_ML_Toolkit/bin/algos/GaussianNB.py) - algos.conf stanza:
[GaussianNB] - Class bases:
ClassifierMixin,BaseAlgo
Source Permalink to this section
Adapted from the Splunk AI Toolkit 5.6.4 documentation at /en/splunk-cloud-platform/apply-machine-learning/use-ai-toolkit/5.6.4/algorithms-and-scoring-metrics-in-the-ai-toolkit/algorithms-in-the-ai-toolkit (section: classifier).