Previous topic

Generic MLProblems

Next topic

Ranking MLProblems

This Page

Classification MLProblems

The mlproblems.classification module contains MLProblems specifically for classification problems.

This module contains the following classes:

  • ClassificationProblem: Generates a classification problem.
  • ClassificationFrom3DLabelingProblem: Generates a classification from 3D labeling problem.
  • ClassSubsetProblem: Extracts examples from a subset of all classes.
class mlproblems.classification.ClassificationProblem(data=None, metadata={}, call_setup=True)[source]

Generates a classification problem.

The data should be an iterator over input/target pairs.

Required metadata:

  • 'targets': The set of possible values for the target.

Defined metadata:

  • 'class_to_id': A dictionary mapping from elements in 'targets' to a class id.
class mlproblems.classification.ClassificationFrom3DLabelingProblem(data=None, metadata={}, call_setup=True, n_examples_per_labeling=100, proportion_per_label=None, patch_sizes=[4, 4, 4], filter_based_on_input=None, seed=25)[source]

Generates a classification from a 3D labeling problem.

The data should be an iterator over input/target pairs (tuple) of 3D numpy arrays. This MLProblem will generate from them a regular classification problem, where the generated input will be a 3D patch extracted around some given voxel, and the target will be the label associated with the center voxel.

Option n_examples_per_labeling determines how many patches will be created from the data.

Option proportion_per_label determines the proportion of patches per label that will be extracted from the data.

Option patch_sizes determines the dimension of the patch taken. Each dimensions is the radius around the center voxel.

Option filter_based_on_input determines a threshold on the center voxel, to filter output certain patches. If None (default) no filter is applied.

Option seed determines the seed that will be used to shuffle the patches.

Required metadata:

  • 'targets': The set of possible values for the target.
class mlproblems.classification.ClassSubsetProblem(data=None, metadata={}, call_setup=True, subset=[], include_class=True)[source]

Extracts examples in a dataset belonging to some subset of classes.

Option subset gives the set of class symbols that should be included. The metadata 'class_to_id' that maps symbols to IDs is required (it is assumed that the targets have already been processed by this mapping, see ClassificationProblem).

Option include_class determines whether to put the class ID in the example or only yield the input.

Required metadata:

  • 'class_to_id'

Defined metadata:

  • 'class_to_id'
  • 'targets'