NominalVariables

NominalVariables
is an option for machine learning functions such as LinearModelFit or Classify that specifies which variables should be treated as having discrete values specified by names.

DetailsDetails

  • Possible settings for NominalVariables include:
  • Automaticautomaticaly detect nominal variables
    Alltreat all variables as nominal
    Nonetreat no variables as nominal
    {v1,v2,}treat the variables as nominal
  • When NominalVariables->Automatic, different methods are used to detect nominal variables. In functions returning FittedModel[], variables with non-numeric data values are treated as nominal.
  • In Classify and Predict, when variables are not named, a list of indices can be given.
  • In linear models, a nominal variable v with possible values , , is represented as a collection of variables with values or corresponding to each case .

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Define some data:

In[1]:=
Click for copyable input

Fit the data, treating the first variable as a nominal variable:

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

See the functional form:

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

Treat all variables as nominal:

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

Train a classifier without specifying which features are nominal:

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

The features are assumed to be numerical:

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

Specify by their indices that both features should be considered nominal:

In[5]:=
Click for copyable input
Out[5]=
In[6]:=
Click for copyable input
Out[6]=
In[7]:=
Click for copyable input
Out[7]=
Introduced in 2008
(7.0)