ClassPriors

ClassPriors
is an option for Classify and related functions that specifies explicit prior probabilities to assume for output classes, independent of anything deduced from the training set.

DetailsDetails

  • ClassPriors-><|class1->p1,class2->p2,|> specifies that the prior probability to classify a particular input as being in class should be .
  • By default, the class priors are computed from the class frequencies of the training set.
  • In ClassPriors-><|class1->p1,class2->p2,|>, unspecified class priors will be set to their rescaled default value to ensure normalization of the distribution.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

Train a classifier on an unbalanced training set:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

Obtain class probabilities for a new example:

In[3]:=
Click for copyable input
Out[3]=

Set a uniform prior distribution for the classes:

In[4]:=
Click for copyable input
Out[4]=

Set the prior distribution of classes inside the classifier:

In[5]:=
Click for copyable input
Out[5]=
In[6]:=
Click for copyable input
Out[6]=

Priors of unspecified classes are functions of the remaining probability mass:

In[7]:=
Click for copyable input
Out[7]=
In[8]:=
Click for copyable input
Out[8]=
Introduced in 2014
(10.0)