Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

FeatureTypes

FeatureTypes
is an option for machine learning functions such as Classify or Predict that specifies what feature types to assume for elements of input data given.

DetailsDetails

  • Possible settings for FeatureTypes include:
  • Automaticautomatically detect types of all features
    typeinterpret the unique feature as type
    {t1,t2,}interpret the i^(th) feature as type ti
    <|iti,jtj,|>interpret the i^(th) feature as type ti etc.
    <|{i,j,}t,|>interpret the i^(th), j^(th), etc. features as type t
    <|"n1"t1,"n2"t2,|>interpret the feature named "ni" as type ti
    <|{"n1","n2",}t,|>interpret the features named "n1", "n2", etc. as type t
  • Possible feature types include:
  • Automaticautomatically detected type
    "Numerical"continuous numerical real values
    "Nominal"discrete values specified by names
    "Boolean"Boolean values
    "Text"natural language string
    "Image"2D image
    "Image3D"3D image
    "Sound"acoustic signal
    "Date"date as a string or DateObject
    "Time"time as a string or TimeObject
    "Color"color
    "NumericalBag"collection of numerical values
    "NominalBag"collection of nominal values
    "NumericalSequence"ordered collection of numerical values
    "NominalSequence"ordered collection of nominal values
    "NumericalVector"fixed-length vector of numerical values
    "NominalVector"fixed-length vector of nominal values
  • When the type of a feature is not specified, or is specified as Missing[], it is considered as Automatic.
  • The value of option FeatureTypes supersedes the value of option NominalVariables, except when FeatureTypes->Automatic.

ExamplesExamplesopen allclose all

Basic Examples  (4)Basic Examples  (4)

Train a predictor without specifying features types:

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 that the first feature should be interpreted as a nominal variable, while the type of the second should be determined automatically:

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

Train a classifier on data where the feature is intended to be a sequence of tokens:

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

Classify wrongly assumed that examples contained two different nominal features:

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

The following classification will output an error message:

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

Force Classify to interpret the feature as a "NominalSequence":

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

Classify a new example:

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

Train a predictor on textual data:

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

The feature has been wrongly interpreted as a nominal feature:

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

Specify that the feature should be considered textual:

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

Predict a new example:

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

Train a classifier with named features:

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

Both features have been considered numerical:

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

Specify that the feature "gender" should be considered nominal:

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

The value of FeatureTypes supersedes the value of NominalVariables:

In[6]:=
Click for copyable input
Out[6]=
In[7]:=
Click for copyable input
Out[7]=
Introduced in 2015
(10.1)