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.

Details

  • 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 Hold[Transmogrify`Private`out], Hold[Transmogrify`Private`out], etc. as type t
  • Possible feature types include:
  • Automaticautomatically detected type
    "Audio"acoustic signal
    "Boolean"Boolean value
    "BooleanTensor"fixed-dimension array of Boolean values
    "BooleanVector"fixed-length vector of Boolean values
    "Color"color
    "Complex"complex value
    "ComplexTensor"fixed-dimension array of complex values
    "ComplexVector"fixed-length vector of complex values
    "Date"date as a string or DateObject
    "Image"2D image
    "Image3D"3D image
    "Nominal"discrete value specified by a name
    "NominalBag"collection of nominal values
    "NominalSequence"ordered collection of nominal values
    "NominalTensor"fixed-dimension array of nominal values
    "NominalVector"fixed-length vector of nominal values
    "Numerical"continuous numerical real value
    "NumericalBag"collection of numerical values
    "NumericalSequence"ordered collection of numerical values
    "NumericalTensor"fixed-dimension array of numerical values
    "NumericalVector"fixed-length vector of numerical values
    "NumericalVectorSequence"sequence of numerical vectors
    "NumericalTensorSequence"sequence of numerical tensors
    "Text"natural language string
    "Time"time as a string or TimeObject
  • 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 FeatureTypesAutomatic.

Examples

Basic Examples  (4)

Train a predictor without specifying feature types:

The features are assumed to be numerical:

Specify that the first feature should be interpreted as a nominal variable, while the type of the second should be determined automatically:

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

Classify wrongly assumed that examples contained two different text features:

The following classification will output an error message:

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

Classify a new example:

Train a predictor on nominal data:

The feature has been wrongly interpreted as text:

Specify that the feature should be considered nominal:

Predict an example:

Train a classifier with named features:

Both features have been considered numerical:

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

Introduced in 2015
 (10.1)
 |
Updated in 2017
 (11.2)