Class ClassifierMappingExtensions
Extension methods for the IClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures> interface.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Learners.Mappings
Assembly: Microsoft.ML.Probabilistic.Learners.Classifier.dll
Syntax
public static class ClassifierMappingExtensions
Methods
ForEvaluation<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures>(IClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures>)
Chains a given classifier mapping with an evaluator mapping, making it possible to evaluate a classifier on the mapped data.
Declaration
public static ClassifierEvaluatorMapping<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures> ForEvaluation<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures>(this IClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures> mapping)
Parameters
Type | Name | Description |
---|---|---|
IClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures> | mapping | The classifier mapping to chain with the evaluator mapping. |
Returns
Type | Description |
---|---|
ClassifierEvaluatorMapping<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures> | The classifier evaluator mapping. |
Type Parameters
Name | Description |
---|---|
TInstanceSource | The type of a source of instances. |
TInstance | The type of an instance. |
TLabelSource | The type of a source of labels. |
TLabel | The type of a label. |
TFeatures | The type of the features. |
GetClassLabelsSafe<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures>(IClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures>, TInstanceSource, TLabelSource)
Safely gets all class labels.
Declaration
public static IReadOnlyList<TLabel> GetClassLabelsSafe<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures>(this IClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures> mapping, TInstanceSource instanceSource = null, TLabelSource labelSource = null)
Parameters
Type | Name | Description |
---|---|---|
IClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures> | mapping | The mapping. |
TInstanceSource | instanceSource | An optional instance source. |
TLabelSource | labelSource | An optional label source. |
Returns
Type | Description |
---|---|
IReadOnlyList<TLabel> | All possible values of a label. |
Type Parameters
Name | Description |
---|---|
TInstanceSource | The type of a source of instances. |
TInstance | The type of an instance. |
TLabelSource | The type of a source of labels. |
TLabel | The type of a label. |
TFeatures | The type of the features. |
Exceptions
Type | Condition |
---|---|
MappingException | Thrown if the class labels are null, empty, identical or not unique. |