"Class" (Net Decoder)

NetDecoder["Class"]

represents a decoder that interprets a vector as class probabilities.

NetDecoder[{"Class",{c1,c2,}}]

represents a decoder with class labels ci.

Details

  • 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

Examples

open allclose all

Basic Examples  (1)

Create a class decoder:

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

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

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

Obtain the probability of getting each class:

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

Scope  (4)

See Also

NetDecoder  NetEncoder  NetChain  NetGraph  FeatureExtract  Ordering  TakeLargestBy  UnitVector

Tutorials

Related NetEncoders

Related NetDecoders