Class BayesPointMachineClassifierMappingExtensions
Extension methods for the IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel> interface.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Learners.Mappings
Assembly: Microsoft.ML.Probabilistic.Learners.Classifier.dll
Syntax
public static class BayesPointMachineClassifierMappingExtensions
Methods
GetAllFeatureVectorIndexesSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel>, TInstanceSource, Int32)
Safely retrieves the feature indexes of all instances from a specified batch of the instance source.
Declaration
public static int[][] GetAllFeatureVectorIndexesSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(this IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel> mapping, TInstanceSource instanceSource, int batchNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel> | mapping | The mapping. |
TInstanceSource | instanceSource | The instance source. |
Int32 | batchNumber | An optional batch number. Defaults to 0 and is used only if the instance source is divided into batches. |
Returns
Type | Description |
---|---|
Int32[][] | The feature indexes provided by the specified batch of the instance source. |
Type Parameters
Name | Description |
---|---|
TInstanceSource | The type of the instance source. |
TInstance | The type of an instance. |
TLabelSource | The type of the label source. |
TLabel | The type of a label. |
Exceptions
Type | Condition |
---|---|
MappingException | Thrown if the feature indexes are empty or contain instances with duplicate, negative or null indexes. |
GetAllFeatureVectorValuesSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel>, TInstanceSource, Int32)
Safely retrieves the feature values of all instances from a specified batch of the instance source.
Declaration
public static double[][] GetAllFeatureVectorValuesSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(this IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel> mapping, TInstanceSource instanceSource, int batchNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel> | mapping | The mapping. |
TInstanceSource | instanceSource | The instance source. |
Int32 | batchNumber | An optional batch number. Defaults to 0 and is used only if the instance source is divided into batches. |
Returns
Type | Description |
---|---|
Double[][] | The feature values provided by the specified batch of the instance source. |
Type Parameters
Name | Description |
---|---|
TInstanceSource | The type of the instance source. |
TInstance | The type of an instance. |
TLabelSource | The type of the label source. |
TLabel | The type of a label. |
Exceptions
Type | Condition |
---|---|
MappingException | Thrown if the feature values are null, empty or contain infinite values or NaNs. |
GetAllLabelsSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel>, TInstanceSource, TLabelSource, Int32)
Safely retrieves an array of labels for the specified batch of the instance source.
Declaration
public static TLabel[] GetAllLabelsSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(this IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel> mapping, TInstanceSource instanceSource, TLabelSource labelSource = null, int batchNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel> | mapping | The mapping. |
TInstanceSource | instanceSource | The instance source. |
TLabelSource | labelSource | An optional label source. |
Int32 | batchNumber | An optional batch number. Defaults to 0 and is used only if the instance and label sources are divided into batches. |
Returns
Type | Description |
---|---|
TLabel[] | The labels provided by the specified batch of the sources. |
Type Parameters
Name | Description |
---|---|
TInstanceSource | The type of the instance source. |
TInstance | The type of an instance. |
TLabelSource | The type of the label source. |
TLabel | The type of a label. |
Exceptions
Type | Condition |
---|---|
MappingException | Thrown if the array of labels is null or empty. |
GetClassCountSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel>, TInstanceSource, TLabelSource)
Safely retrieves the number of classes that the Bayes point machine classifier is used for.
Declaration
public static int GetClassCountSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(this IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel> mapping, TInstanceSource instanceSource = null, TLabelSource labelSource = null)
Parameters
Type | Name | Description |
---|---|---|
IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel> | mapping | The mapping. |
TInstanceSource | instanceSource | An optional instance source. |
TLabelSource | labelSource | An optional label source. |
Returns
Type | Description |
---|---|
Int32 | The number of classes that the Bayes point machine classifier is used for. |
Type Parameters
Name | Description |
---|---|
TInstanceSource | The type of the instance source. |
TInstance | The type of an instance. |
TLabelSource | The type of the label source. |
TLabel | The type of a label. |
Exceptions
Type | Condition |
---|---|
MappingException | Thrown if there are less than three classes. |
GetFeatureCountSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel>, TInstanceSource)
Safely retrieves the total number of features for the specified instance source.
Declaration
public static int GetFeatureCountSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(this IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel> mapping, TInstanceSource instanceSource = null)
Parameters
Type | Name | Description |
---|---|---|
IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel> | mapping | The mapping. |
TInstanceSource | instanceSource | An optional instance source. |
Returns
Type | Description |
---|---|
Int32 | The total number of features. |
Type Parameters
Name | Description |
---|---|
TInstanceSource | The type of the instance source. |
TInstance | The type of an instance. |
TLabelSource | The type of the label source. |
TLabel | The type of a label. |
Exceptions
Type | Condition |
---|---|
MappingException | Thrown if the number of features is negative. |
GetSingleFeatureVectorIndexesSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel>, TInstance, TInstanceSource)
Safely retrieves the feature indexes for a specified instance.
Declaration
public static int[] GetSingleFeatureVectorIndexesSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(this IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel> mapping, TInstance instance, TInstanceSource instanceSource = null)
Parameters
Type | Name | Description |
---|---|---|
IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel> | mapping | The mapping. |
TInstance | instance | The instance. |
TInstanceSource | instanceSource | An optional instance source. |
Returns
Type | Description |
---|---|
Int32[] | The feature indexes for the specified instance. |
Type Parameters
Name | Description |
---|---|
TInstanceSource | The type of the instance source. |
TInstance | The type of an instance. |
TLabelSource | The type of the label source. |
TLabel | The type of a label. |
Exceptions
Type | Condition |
---|---|
MappingException | Thrown if the feature indexes contain duplicates or negative indexes. |
GetSingleFeatureVectorValuesSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel>, TInstance, TInstanceSource)
Safely retrieves the feature values for a specified instance.
Declaration
public static double[] GetSingleFeatureVectorValuesSafe<TInstanceSource, TInstance, TLabelSource, TLabel>(this IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel> mapping, TInstance instance, TInstanceSource instanceSource = null)
Parameters
Type | Name | Description |
---|---|---|
IBayesPointMachineClassifierMapping<TInstanceSource, TInstance, TLabelSource, TLabel> | mapping | The mapping. |
TInstance | instance | The instance. |
TInstanceSource | instanceSource | An optional instance source. |
Returns
Type | Description |
---|---|
Double[] | The feature values for the specified instance. |
Type Parameters
Name | Description |
---|---|
TInstanceSource | The type of the instance source. |
TInstance | The type of an instance. |
TLabelSource | The type of the label source. |
TLabel | The type of a label. |
Exceptions
Type | Condition |
---|---|
MappingException | Thrown if the feature values are null, infinite or NaN. |