"Class" (Net Decoder)


represents a decoder that interprets a vector as class probabilities.


represents a decoder with class labels ci.


  • NetDecoder[][input] applies the decoder to an input to produce an output.
  • NetDecoder[][{input1,input2,}] applies the decoder to a list of inputs to produce a list of outputs.
  • NetDecoder["Class"] uses successive integers as class labels.
  • NetDecoder[{"Class",,"InputDepth"->n}] can be used to specify that the input tensor has depth n. The default depth is 1, indicating that the input is a vector. For matrix or higher-rank inputs, the last dimension is interpreted as the class dimension. Values must sum to 1 across this dimension.
  • A decoder can be attached to an output port of a net by specifying "port"->NetDecoder[] when constructing the net.
  • Properties
  • NetDecoder[][data,prop] can be used to calculate a specific property for the input data.
  • When a "Class" decoder is attached to a net, net[data,prop] or net[data,"oport"->prop] can be used to calculate a specific property of the decoded output.
  • The "Class" decoder supports the following properties prop:
  • "Decision"the class ci with the highest probability (default)
    {"TopDecisions",n}the n classes with the highest probabilities
    "TopProbabilities"probabilities for the most likely ci, returned as a list of rules
    {"TopProbabilities",n}probabilities for the n most likely ci
    "Probabilities"the association <|c1->p1,c2->p2,|>
    {"Probability",ci}probability for a specific ci
    "Entropy"the entropy of the probability distribution
    "RandomSample"sample each class proportionally to its probability
    {"RandomSample",t}sample using a positive temperature t


open allclose all

Basic Examples  (1)

Create a class decoder:

Click for copyable input

Use the decoder on a probability vector to return the most probable class:

Click for copyable input

Obtain the probability of getting each class:

Click for copyable input

Scope  (4)

See Also

NetDecoder  NetEncoder  NetChain  NetGraph  FeatureExtract  Ordering  TakeLargestBy  UnitVector


Related NetEncoders

Related NetDecoders