Class ClassifierEvaluatorMappingExtensions
Extension methods for the IClassifierEvaluatorMapping<TInstanceSource, TInstance, TLabelSource, TLabel> interface.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Learners.Mappings
Assembly: Microsoft.ML.Probabilistic.Learners.Classifier.dll
Syntax
public static class ClassifierEvaluatorMappingExtensions
  Methods
GetClassLabelsSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(IClassifierEvaluatorMapping<TInstanceSource, TInstance, TLabelSource, TLabel>, TInstanceSource, TLabelSource)
Safely gets all class labels.
Declaration
public static IEnumerable<TLabel> GetClassLabelsSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(this IClassifierEvaluatorMapping<TInstanceSource, TInstance, TLabelSource, TLabel> mapping, TInstanceSource instanceSource = null, TLabelSource labelSource = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IClassifierEvaluatorMapping<TInstanceSource, TInstance, TLabelSource, TLabel> | mapping | The mapping.  | 
      
| TInstanceSource | instanceSource | An optional instance source.  | 
      
| TLabelSource | labelSource | An optional label source.  | 
      
Returns
| Type | Description | 
|---|---|
| IEnumerable<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.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| MappingException | Thrown if the class labels are null, empty, identical or not unique.  | 
      
GetInstancesSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(IClassifierEvaluatorMapping<TInstanceSource, TInstance, TLabelSource, TLabel>, TInstanceSource)
Safely retrieves instances for a given instance source.
Declaration
public static IEnumerable<TInstance> GetInstancesSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(this IClassifierEvaluatorMapping<TInstanceSource, TInstance, TLabelSource, TLabel> mapping, TInstanceSource instanceSource)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IClassifierEvaluatorMapping<TInstanceSource, TInstance, TLabelSource, TLabel> | mapping | The mapping.  | 
      
| TInstanceSource | instanceSource | The source of instances.  | 
      
Returns
| Type | Description | 
|---|---|
| IEnumerable<TInstance> | The instances provided by the instance source.  | 
      
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.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| MappingException | Thrown if the retrieved instances are null.  | 
      
GetLabelSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(IClassifierEvaluatorMapping<TInstanceSource, TInstance, TLabelSource, TLabel>, TInstance, TInstanceSource, TLabelSource)
Safely retrieves the label for a given instance.
Declaration
public static TLabel GetLabelSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(this IClassifierEvaluatorMapping<TInstanceSource, TInstance, TLabelSource, TLabel> mapping, TInstance instance, TInstanceSource instanceSource = null, TLabelSource labelSource = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IClassifierEvaluatorMapping<TInstanceSource, TInstance, TLabelSource, TLabel> | mapping | The mapping.  | 
      
| 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.  | 
      
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.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| MappingException | Thrown if the retrieved label is null.  |