Class ClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures>
Provides a default implementation of IClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures>
Implements
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Learners.Mappings
Assembly: Microsoft.ML.Probabilistic.Learners.Classifier.dll
Syntax
[Serializable]
public abstract class ClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures> : IClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures>, IPredictorMapping<TInstanceSource, TInstance, TLabelSource, TLabel, TFeatures>
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 feature values. |
Methods
GetClassLabels(TInstanceSource, TLabelSource)
Gets all class labels.
Declaration
public abstract IEnumerable<TLabel> GetClassLabels(TInstanceSource instanceSource = null, TLabelSource labelSource = null)
Parameters
Type | Name | Description |
---|---|---|
TInstanceSource | instanceSource | An optional instance source. |
TLabelSource | labelSource | An optional label source. |
Returns
Type | Description |
---|---|
IEnumerable<TLabel> | All possible values of a label. |
GetFeatures(TInstance, TInstanceSource)
Provides the features for a given instance.
Declaration
public abstract TFeatures GetFeatures(TInstance instance, TInstanceSource instanceSource = null)
Parameters
Type | Name | Description |
---|---|---|
TInstance | instance | The instance to provide features for. |
TInstanceSource | instanceSource | An optional source of instances. |
Returns
Type | Description |
---|---|
TFeatures | The features for the given instance. |
Remarks
Assumes that the same instance source always provides the same features for a given instance.
GetInstances(TInstanceSource)
Provides the instances for a given instance source.
Declaration
public abstract IEnumerable<TInstance> GetInstances(TInstanceSource instanceSource)
Parameters
Type | Name | Description |
---|---|---|
TInstanceSource | instanceSource | The source of instances. |
Returns
Type | Description |
---|---|
IEnumerable<TInstance> | The instances provided by the instance source. |
Remarks
Assumes that the same instance source always provides the same instances.
GetLabel(TInstance, TInstanceSource, TLabelSource)
Provides the label for a given instance.
Declaration
public abstract TLabel GetLabel(TInstance instance, TInstanceSource instanceSource = null, TLabelSource labelSource = null)
Parameters
Type | Name | Description |
---|---|---|
TInstance | instance | The instance to provide the label for. |
TInstanceSource | instanceSource | An optional source of instances. |
TLabelSource | labelSource | An optional source of labels. |
Returns
Type | Description |
---|---|
TLabel | The label of the given instance. |
Remarks
Assumes that the same sources always provide the same label for a given instance.
LabelToString(TLabel)
Serializes a label to a string.
Declaration
public virtual string LabelToString(TLabel label)
Parameters
Type | Name | Description |
---|---|---|
TLabel | label |
Returns
Type | Description |
---|---|
String |
ParseLabel(String)
Deserializes a label from a string. Reverses LabelToString(TLabel).
Declaration
public virtual TLabel ParseLabel(string labelString)
Parameters
Type | Name | Description |
---|---|---|
String | labelString | The output of LabelToString(TLabel) |
Returns
Type | Description |
---|---|
TLabel | The label |