({{, (RefLink[FeatureExtract, paclet:ref/FeatureExtract])[{(Subscript[example, 1]),(Subscript[example, 2]),…}]
extracts features for each of the (Subscript[example, i]) using a feature extractor trained on all the (Subscript[example, i]).}, {, (RefLink[FeatureExtract, paclet:ref/FeatureExtract])[examples,extractor]
extracts features using the specified feature extractor method.}, {, (RefLink[FeatureExtract, paclet:ref/FeatureExtract])[examples,{(Subscript[extractor, 1]),(Subscript[extractor, 2]),…}]
extracts features by applying the (Subscript[extractor, i]) in sequence.}, {, (RefLink[FeatureExtract, paclet:ref/FeatureExtract])[examples,spec->ext]
uses the extractor methods specified by ext on parts of examples specified by spec. }, {, (RefLink[FeatureExtract, paclet:ref/FeatureExtract])[examples,{(Subscript[spec, 1])->(Subscript[ext, 1]),(Subscript[spec, 2])->(Subscript[ext, 2]),…}]
uses the extractor methods (Subscript[ext, i]) on parts of examples specified by the (Subscript[spec, i]).}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[FeatureExtract, paclet:ref/FeatureExtract]) can be used on many types of data, including numerical, textual, sounds and images, and combinations of these.

Each (Subscript[example, i]) can be a single data element, a list of data elements, an association of data elements, or a (RefLink[Dataset, paclet:ref/Dataset]) object.

Possible feature extractor methods include:

Additional feature extractor methods can also be used for each data type.

Numeric data:

Nominal data:

Text:

Images:

Audio objects:

Feature extractor methods are applied to data elements with whose types they are compatible. Other data elements are returned unchanged.

(RefLink[FeatureExtract, paclet:ref/FeatureExtract])[examples] is typically equivalent to (RefLink[FeatureExtract, paclet:ref/FeatureExtract])[examples,"NumericVector"].

In (RefLink[FeatureExtract, paclet:ref/FeatureExtract])[examples,spec->ext] or (RefLink[FeatureExtract, paclet:ref/FeatureExtract])[examples,{(Subscript[spec, 1])->(Subscript[ext, 1]),…}], possible forms for spec and the (Subscript[spec, i]) include:

Parts not mentioned in spec or the (Subscript[spec, i]) are dropped for the purpose of extracting features.

In (RefLink[FeatureExtract, paclet:ref/FeatureExtract])[examples,{(Subscript[spec, 1])->(Subscript[ext, 1]),…}], the (Subscript[ext, i]) are all applied separately to examples.

The following options can be given:

Possible settings for (RefLink[RandomSeeding, paclet:ref/RandomSeeding]) include:

(RefLink[FeatureExtract, paclet:ref/FeatureExtract])[…] is equivalent to (RefLink[FeatureExtraction, paclet:ref/FeatureExtraction])[…,"ExtractedFeatures"].

OpenersPrimaryExamplesSection(Spacer1)Examples  (15)

OpenersExampleSection0(Spacer1)Basic Examples  (4)

Extract features from a simple dataset:

FeatureExtract[{{1.4,"A"},{1.5,"A"},{2.3,"B"},{5.4,"B"}}]

Extract feature from images:

FeatureExtract[{,, ,,,}]

Standardized numerical values using the "StandardizedVector" extractor method:

FeatureExtract[{{1.4,30.1},{1.5,46.3},{2.3,27.4},{5.4,51.2}},"StandardizedVector"]

Extract TFIDF vectors on characters by chaining the extractor methods "SegmentedCharacters" and "TFIDF":

FeatureExtract[{"the cat is grey","my cat is fast","this dog is scary","the big dog"},{"SegmentedCharacters","TFIDF"}] // MatrixForm

OpenersExampleSection1(Spacer1)Scope  (8)

Extract features from a list of (RefLink[DateObject, paclet:ref/DateObject]):

FeatureExtract[{(DateObject["Mon 5 May 2014 09:53:06""GMT"-6.`, DateObject[{2014,5,5,9,53,6.301579`},"Instant","Gregorian",-6.`]]),(DateObject["Sat 1 Jan 2000 00:00:00""GMT"-6.`, DateObject[{2000,1,1,0,0,0.`},"Instant","Gregorian",-6.`]]),(DateObject["Month: ""Dec 2006", DateObject[{2006,12},"Month","Gregorian",-6.`]]),(DateObject["Day: ""Thu 23 Aug 2007", DateObject[{2007,8,23},"Day","Gregorian",-6.`]]),(DateObject["Mon 4 Apr 2016 15:59:18""GMT"-4.`, DateObject[{2016,4,4,15,59,18.273754`},"Instant","Gregorian",-4.`]])}]

Compute term frequency-inverse document frequency vectors from texts:

FeatureExtract[{"the cat is grey","my cat is fast","this dog is scary","the big dog"},"TFIDF"] // MatrixForm

By default, texts will be segmented into words. This gives the same result:

FeatureExtract[{"the cat is grey","my cat is fast","this dog is scary","the big dog"},{"SegmentedWords", "TFIDF"}] // MatrixForm

Extract features on text using the "TFIDF" method followed by the "DimensionReduced" method:

FeatureExtract[{"the cat is grey","my cat is fast","this dog is scary","the big dog"},{"TFIDF","DimensionReducedVector"}]

Extract features with the "IndicatorVector" method on nominal variables:

FeatureExtract[{{"Yes","A"},{"No","A"},{"No","B"},{"Maybe","B"},{"No", "C"}},"IndicatorVector"] // MatrixForm

Extract features with the "IndicatorVector" method on the second nominal variable only:

FeatureExtract[{{"Yes","A"},{"No","A"},{"No","B"},{"Maybe","B"},{"No", "C"}},2->"IndicatorVector"] // MatrixForm

Use the (RefLink[Identity, paclet:ref/Identity]) extractor method to copy the first variable as well:

FeatureExtract[{{"Yes","A"},{"No","A"},{"No","B"},{"Maybe","B"},{"No", "C"}},{2->"IndicatorVector",1->Identity}]

A variable can be copied multiple times:

FeatureExtract[{{"Yes","A"},{"No","A"},{"No","B"},{"Maybe","B"},{"No", "C"}},{2->"IndicatorVector",1->Identity,1->Identity}]

Extract features on a mixed-type dataset:

FeatureExtract[{{"the cat is grey",},{"my cat is fast",},{"this dog is scary",},{"the big dog",}}]

Extract features on texts and images using the "TFIDF" method:

FeatureExtract[{{"the cat is grey",},{"my cat is fast",},{"this dog is scary",},{"the big dog",}},"TFIDF"]

Features have only been extracted from the text part, since "TFIDF" does not apply to images.

Extract features from a dataset that contains missing values:

FeatureExtract[{{1.4,Missing[],"A"},{1.5,50.2,"A"},{Missing[],42.3,"B"},{5.4,61.7,"B"}}]

Extract features from a dataset formatted as a list of associations:

FeatureExtract[{<|"age"->32,"height"->160, "gender"-> "female"|>,
<|"height"->183,"age"->41,"gender"-> "female"|>,
<|"height"->123,"age"->30,"gender"-> "female"|>,
<|"height"->175,"age"->21,"gender"-> "male"|>,
<|"height"->150,"age"->11,"gender"-> "male"|>,
<|"age"->52,"height"->164,"gender"-> "female"|>}]

OpenersExampleSection2(Spacer1)Options  (2)

OpenersExampleSubsection0(Spacer1)FeatureNames  (1)

Use (RefLink[FeatureNames, paclet:ref/FeatureNames]) to name features, and refer to their names in part specifications:

FeatureExtract[{{2.3,"male"},{4.8,Missing[]},{Missing[],"female"},{5.2,"female"}},{"age"-> Identity,"gender"-> "IndicatorVector"},FeatureNames->{"age","gender"}] // MatrixForm

OpenersExampleSubsection1(Spacer1)FeatureTypes  (1)

Extract features with the "IndicatorVector" method on a simple dataset:

FeatureExtract[{{1,"A"},{2,"A"},{2,"B"},{1,"B"}},"IndicatorVector"]

The first feature has been interpreted as numerical, and since the "IndicatorVector" method only acts on nominal features, the first feature is unchanged.

Use (RefLink[FeatureTypes, paclet:ref/FeatureTypes]) to enforce the interpretation of the first feature as nominal:

FeatureExtract[{{1,"A"},{2,"A"},{2,"B"},{1,"B"}},"IndicatorVector",FeatureTypes-><|1->"Nominal"|>]// MatrixForm

OpenersExampleSection3(Spacer1)Applications  (1)

OpenersExampleSubsection2(Spacer1)Dataset Visualization  (1)

Construct a dataset of dog images:

dataset={,,,,,,,,,,,,,,,,,,,,};

Extract features from this dataset:

features=FeatureExtract[dataset];

Reduce the dimension of the extracted vectors to 2:

xy=DimensionReduce[features,2,Method->"TSNE"]

Visualize the images at their feature positions:

ListPlot[List/@xy,PlotMarkers->(Image[#,ImageSize->40]& /@ dataset),ImageSize->600]

A similar visualization can be directly obtained using (RefLink[FeatureSpacePlot, paclet:ref/FeatureSpacePlot]):

FeatureSpacePlot[dataset]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[FeatureExtraction, paclet:ref/FeatureExtraction])  ▪  (RefLink[FeatureExtractor, paclet:ref/FeatureExtractor])  ▪  (RefLink[DimensionReduce, paclet:ref/DimensionReduce])  ▪  (RefLink[FeatureSpacePlot, paclet:ref/FeatureSpacePlot])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Machine Learning, paclet:guide/MachineLearning])}, {▪(RefLinkPlain[Image Computation for Microscopy, paclet:guide/ImageComputationForMicroscopy])}})}})