ClassifierFunction

ClassifierFunction[]

represents a function generated by Classify that classifies data into classes.

Details and Options

  • ClassifierFunction works like Function.
  • ClassifierFunction[][data] attempts to classify data, returning the class in which data is considered most likely to be.
  • ClassifierFunction[][{data1,data2,}] attempts to classify all the datai.
  • ClassifierFunction[][data,prop] gives the specified property of the classification associated with data.
  • Possible properties applicable to all methods include:
  • "Decision"best class according to the probabilities and the utility function
    "TopProbabilities"probabilities for most likely classes
    "TopProbabilities"nprobabilities for the n most likely classes
    "Probability"classprobability for a specific class
    "Probabilities"association of probabilities for all possible classes
    "Properties"list of all properties available
  • ClassifierFunction[][data,,opts] specifies that the classifier should use the options opts when applied to data.
  • Possible options are:
  • ClassPriorsAutomaticexplicit prior probabilities for classes
    IndeterminateThresholdAutomaticbelow what probability to return Indeterminate
    PerformanceGoalAutomaticwhich aspect of performance to optimize
    TargetDevice"CPU"the target device on which to perform training
    UtilityFunctionAutomaticutility expressed as a function of actual and predicted class
  • A ClassifierFunction[] trained in an older version of the Wolfram Language will still work in the current version.
  • Classify[net] can be used to convert a NetChain or NetGraph representing a classifier into a ClassifierFunction[].
  • Classify[ClassifierFunction[],opts], can be used to update the values of PerformanceGoal, ClassPriors, IndeterminateThreshold, UtilityFunction or FeatureExtractor of the classifier.
  • In Classify[ClassifierFunction[],FeatureExtractorfe], the FeatureExtractorFunction[] fe will be prepended to the existing feature extractor.
  • Information[ClassifierFunction[]] generates an information panel about the classifier and its estimated performances.
  • Information[ClassifierFunction[],prop] can be used to obtain specific properties.
  • Information of a ClassifierFunction may include the following properties:
  • "Accuracy"estimated accuracy of the classifier
    "BatchEvaluationTime"marginal time to predict one example when a batch is given
    "Classes"list of classes that the classifier can return
    "ClassNumber"number of classes that the classifier can return
    "EvaluationTime"time needed to classify one example
    "ExampleNumber"number of training examples
    "FeatureTypes"feature types of the classfier input
    "FunctionMemory"memory needed to store the classifier
    "FunctionProperties"all classification properties available for this classifier
    "IndeterminateThreshold"value of IndeterminateThreshold used by the classifier
    "LearningCurve"performance as a function of the training set size
    "MaxTrainingMemory"maximum memory used during training
    "MeanCrossEntropy"estimated mean cross entropy of the classifier
    "Method"value of Method used by the classifier
    "MethodDescription"summary of the method
    "MethodOption"full method option to be reused in a new training
    "Properties"all information properties available for this classifier
    "TrainingTime"time used by Classify to generate the classifier
    "UtilityFunction"value of UtilityFunction used by the classifier
  • Information properties also include all method suboptions.

Examples

open all close all

Basic Examples  (2)

Create a ClassifierFunction with Classify and a list of labeled examples:

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

Classify an unlabeled example with the ClassifierFunction:

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

Classify multiple examples:

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

Return the probabilities of the classes given the feature of an example:

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

Return the sorted probabilities of the most likely classes:

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

Return the probability of the most probable class:

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

Return the probability of a given class:

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

Plot the probability of class "B" as a function of the feature:

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

Generate a ClassifierFunction using multiple features:

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

Use the function on a new example:

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

Classify an example that has missing features:

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

Get the probabilities for the most probable classes:

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

Scope  (4)

Options  (4)

Introduced in 2014
(10.0)
|
Updated in 2018
(11.3)