ActiveClassification

ActiveClassification[f,{conf1,conf2,}]

gives an object representing the result of active classification obtained by using the function f to determine classes for the example configurations confi.

ActiveClassification[f,reg]

generates configurations within the region specified by reg.

ActiveClassification[f,sampler]

generates configurations by applying the function sampler.

ActiveClassification[f,{conf1,conf2,}nsampler]

applies the function nsampler to successively generate configurations starting from one of the confi.

Details and Options

  • ActiveClassification[] returns an ActiveClassificationObject[] whose properties can be obtained using ActiveClassificationObject[]["prop"].
  • Possible properties include:
  • "EvaluationHistory"configurations explored and classes assigned to them
    "Method"method used for active classification
    "ClassifierFunction"best ClassifierFunction[] obtained
    "ClassifierMeasurementsObject"latest ClassifierMeasurementsObject[] obtained
    "LearningCurve"plot of mean cross-entropy evolution
    "Properties"list of all available properties
  • Configurations can be of any form accepted by Classify (single data element, list of data elements, association of data elements, etc.) and of any type accepted by Classify (numerical, textual, sounds, images, etc.).
  • When applied to a configuration conf, the output of the function f is interpreted as a label.
  • In ActiveClassification[f,spec], spec defines the domain of the function f. A domain can be defined by a list of configurations, a geometric region or a configuration generator function.
  • In ActiveClassification[f,sampler], sampler[] must output a configuration suitable for f to be applied to it.
  • In ActiveClassification[f,{conf1,conf2,}nsampler], nsampler[conf] must output a configuration.
  • ActiveClassification has the same options as Classify, with the following additions and changes:
  • InitialEvaluationHistoryNoneinitial set of configurations and classes
    MaxIterations2000maximum number of iterations
    MethodAutomaticmethod used to determine configurations to query and the classification algorithm to use
    RandomSeeding1234what seeding of pseudorandom generators should be done internally
  • Possible settings for Method include:
  • Automaticautomatically choose method
    "Randomized"choose random configurations from the domain
    "MaxEntropy"choose configurations for which the classifier has maximum uncertainty
    assocassociation specifying the evaluation strategy and classification method
  • In the form Methodassoc, the association can have elements:
  • "EvaluationStrategy"method for determining which configurations to query
    "ClassificationMethod"method to use for classification
  • Possible settings for RandomSeeding include:
  • Automaticautomatically reseed every time the function is called
    Inheriteduse externally seeded random numbers
    seeduse an explicit integer or strings as a seed

Examples

open allclose all

Basic Examples  (3)

Train an ActiveClassificationObject[] to classify whether an integer is greater than 50:

Extract the resulting classifier:

Classify new examples:

Train a classification object with the domain defined by an interval:

Extract the classifier:

Classify new examples:

Train a classification object to classify whether a matrix is positive semidefinite, with the domain defined by a configuration generator:

Extract the classifier:

Classify new examples:

Scope  (2)

Define a piecewise function with three possible output values:

Train a classification object to classify the possible outputs from the function, with the domain defined by a configuration generator:

Obtain the list of object properties:

Obtain the history of explored configurations:

Obtain the classifiers trained during the active classification, along with their properties:

Obtain the final classifier:

Obtain the method used to choose configurations to add to the training set:

Obtain some other properties:

Display the performances of the classifiers trained during active classification:

Display the confusion matrix of the final classifier for a test set:

Define a function that checks whether a point belongs to a given region, then define a neighborhood configuration generator:

Train a classification object to classify whether a point is a member of a given region:

Display the confusion matrix of the classifier on a test set:

Options  (3)

InitialEvaluationHistory  (1)

Define a function that checks whether the ASCII character corresponding to an integer is a letter, then define a set of configurations:

Construct an initial training set:

Train a classification object to classify whether an integer corresponds to a letter by including the preceding information:

The examples in the first row in the training history now correspond to the initial training set:

MaxIterations  (1)

Train a classification object to classify whether a number in a given interval is positive:

Obtain the number of function evaluations:

Specify the maximum number of iterations:

Check the number of function evaluations now:

Method  (1)

Define a region composed of a number of subregions, and a function that tells whether the blood pressure corresponding to a point in the region is "Low", "Ideal" or "High":

Train a classification object by specifying the method:

The configurations are explored randomly, with the data generating distribution:

Specify a different method for active classification:

The algorithm now prefers to explore configurations near the boundaries where the model is more uncertain:

Specify the method as an association, choosing the evaluation strategy and the classification method:

Applications  (3)

Grade Classifier  (1)

Define a "grade function" that gives a letter grade corresponding to a real score between 0 and 10:

Train a classification object to classify letter grades, with the domain specified by a configuration generator:

Obtain the classifier:

Display the confusion matrix of the classifier on a test set:

Region Member Classifier  (1)

Construct a geometric region corresponding to the map of the USA:

Define a function that tells whether a point lies inside this region:

Train a classification object for this function:

Obtain the corresponding classifier:

Plot the configurations explored during training. The density is higher close to the region boundary:

Visualize the classification region:

Program Choice Classifier  (1)

Define two programs to compute the ManhattanDistance between two elements:

Define a function that selects the program that more quickly computes the ManhattanDistance between two elements constructed from the three integers:

Set the domain of the function via a configuration generator:

Train a classification object to classify which program is faster:

Obtain the classifier:

Display the accuracy and confusion matrix of the classifier on a test set:

Possible Issues  (1)

Specifying the domain of the function via a neighborhood configuration generator requires care.

Define a function that checks whether a point belongs to the unit rectangle, then define a neighborhood configuration generator:

Active classification may not work properly if the initial configuration and neighborhood configuration generator are not chosen properly:

Introduced in 2017
 (11.1)
 |
Updated in 2017
 (11.2)