"FeatureExtractor" (Net Encoder)

NetEncoder[{"FeatureExtractor",f}]

represents an encoder that uses the FeatureExtractorFunction f to encode an input.

NetEncoder["FeatureExtractor"]

represents an encoder automatically learned during net training.

NetEncoder[{"FeatureExtractor","method"}]

uses a specific feature extraction method.

Details

  • In NetEncoder[{"FeatureExtractor",f}], the FeatureExtractorFunction f should return a numeric vector.
  • In NetEncoder["FeatureExtractor"], the extractor is learned on the training data when NetTrain is called on the net containing the encoder. The learned extractor typically returns a numeric vector.
  • In NetEncoder[{"FeatureExtractor","method"}], "method" can be any feature extractor method of FeatureExtraction that produces numeric vectors: "StandardizedVector", "IndicatorVector", "TFIDF", "ImageFeatures", "AudioFeatures", "GraphFeatures", etc.
  • NetEncoder[][input] applies the encoder to an input to produce an output.
  • NetEncoder[][{input1,input2,}] applies the encoder to a list of inputs to produce a list of outputs.
  • An encoder can be attached to an input port of a net by specifying "port"NetEncoder[] when constructing the net.

Examples

Basic Examples  (2)

Define a net with a feature extractor that will automatically be learned on data:

Train the net on images:

Apply the net to a new image:

Take some numeric vectors of dimension 3:

Train a FeatureExtractorFunction that standardizes this data:

Create a function encoder that applies this dimension reduction:

Apply the encoder to an input vector:

It gives the same result as the FeatureExtractorFunction:

The same NetEncoder can be obtained by using NetTrain:

The encoder can also be attached to a net and trained with the net (in a first phase):