"NaiveBayes" (Machine Learning Method)
- Method for Classify.
- Determines the class using Bayes's theorem and assuming that features are independent given the class.
Details & Suboptions
- Naive Bayes is a classification technique based on Bayes's theorem
which assumes that the features
are independent given the class. The class probabilities for a given example are then:
, where
is the probability distribution of feature
given the class, and
is the prior probability of the class. Both distributions are estimated from the training data. In the current implementation, distributions are modeled using a piecewise-constant function (i.e a variable-width histogram).
- The following suboption can be given
-
"SmoothingParameter" .2 regularization parameter
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Train a classifier function on labeled examples:
In[1]:=1

✖
https://wolfram.com/xid/0cbeght3s9cuy9w-9626m
Out[1]=1

Obtain information about the classifier:
In[2]:=2

✖
https://wolfram.com/xid/0cbeght3s9cuy9w-pxhttq
Out[2]=2

In[3]:=3

✖
https://wolfram.com/xid/0cbeght3s9cuy9w-36lxjv
Out[3]=3

Generate some normally distributed data:
In[1]:=1

✖
https://wolfram.com/xid/0cbeght3s9cuy9w-hhp24w
In[2]:=2

✖
https://wolfram.com/xid/0cbeght3s9cuy9w-qddujl
In[3]:=3

✖
https://wolfram.com/xid/0cbeght3s9cuy9w-fcsxx1
Out[3]=3

Train a classifier on this dataset:
In[4]:=4

✖
https://wolfram.com/xid/0cbeght3s9cuy9w-qv36d2
Out[4]=4

Plot the training set and the probability distribution of each class as a function of the features:
In[5]:=5

✖
https://wolfram.com/xid/0cbeght3s9cuy9w-ebncen
Out[5]=5

Options (2)Common values & functionality for each option
"SmoothingParameter" (2)
Train a classifier using the "SmoothingParameter" suboption:
In[1]:=1

✖
https://wolfram.com/xid/0cbeght3s9cuy9w-zbl9s3
Out[1]=1

Train several classifiers on the "FisherIris" dataset by using different settings of the "SmoothingParameter" option:
In[1]:=1

✖
https://wolfram.com/xid/0cbeght3s9cuy9w-puzc5y
In[2]:=2

✖
https://wolfram.com/xid/0cbeght3s9cuy9w-su3mv8
Evaluate these classifiers on a data point that is unlike points from the training set and compare the class probability for class "setosa":
In[3]:=3

✖
https://wolfram.com/xid/0cbeght3s9cuy9w-zt57rx
Out[3]=3

In[4]:=4

✖
https://wolfram.com/xid/0cbeght3s9cuy9w-ykevlo
Out[4]=4
