Class EnumSupport
Provides factors and operators for using Enum types.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Factors
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
public class EnumSupport
Methods
AreEqual<TEnum>(TEnum, TEnum)
Test if two enums are equal.
Declaration
public static bool AreEqual<TEnum>(TEnum a, TEnum b)
Parameters
Type | Name | Description |
---|---|---|
TEnum | a | First integer |
TEnum | b | Second integer |
Returns
Type | Description |
---|---|
Boolean | True if a==b. |
Type Parameters
Name | Description |
---|---|
TEnum |
DiscreteEnum<TEnum>(Vector)
Samples an enum value from a discrete enum distribution.
Declaration
[ParameterNames(new string[]{"Sample", "Probs"})]
public static TEnum DiscreteEnum<TEnum>(Vector probs)
Parameters
Type | Name | Description |
---|---|---|
Vector | probs | Vector of the probability of each Enum value, in order |
Returns
Type | Description |
---|---|
TEnum | An enum sampled from the distribution |
Type Parameters
Name | Description |
---|---|
TEnum | The type of the enum to sample |
EnumToInt<TEnum>(TEnum)
Converts an Enum to an Int
Declaration
[ParameterNames(new string[]{"Int", "Enum"})]
public static int EnumToInt<TEnum>(TEnum en)
Parameters
Type | Name | Description |
---|---|---|
TEnum | en |
Returns
Type | Description |
---|---|
Int32 |
Type Parameters
Name | Description |
---|---|
TEnum |