KeyDataViewType Class


Type representing categorical or enumerated values, most commonly used for the values of labels in multiclass classification models.

public sealed class KeyDataViewType : Microsoft.ML.Data.PrimitiveDataViewType
type KeyDataViewType = class
    inherit PrimitiveDataViewType
Public NotInheritable Class KeyDataViewType
Inherits PrimitiveDataViewType


The underlying .NET type is one of the unsigned integer types. The default is UInt32, but it can also be Byte, UInt16, or UInt64. Despite keys being numerical types, the information is not inherently numeric, so typically, arithmetic is not meaningful.

Missing values are mapped to 0.

The first non-missing value of the set is always 1.

The other values range up to the value of Count.

For example, if you have a key value with a Count of 3, then the UInt32 value 0 corresponds to missing key values, and one of the values of 1, 2, or 3 is of the valid values, and no other values are used.


KeyDataViewType(Type, Int32)

Initializes a new instance of the KeyDataViewType class. This differs from the hypothetically more general KeyDataViewType(Type, UInt64) constructor by taking an Int32 for count, to more naturally facilitate the most common case that the key value is being used as an enumeration over an array or list of some form.

KeyDataViewType(Type, UInt64)

Initializes a new instance of the KeyDataViewType class.



Count is the cardinality of the KeyDataViewType.


The raw Type for this DataViewType. Note that this is the raw representation type and not the complete information content of the DataViewType.

(Inherited from DataViewType)



Determine if this KeyDataViewType object is equal to another DataViewType instance. Checks if the other item is the type of KeyDataViewType, if the RawType is the same, and if the Count is the same.


Determine if a KeyDataViewType instance is equal to another KeyDataViewType instance. Checks if any object is the type of KeyDataViewType, if the RawType is the same, and if the Count is the same.


Retrieves the hash code.


Returns true iff the given type is valid for a KeyDataViewType. The valid ones are Byte, UInt16, UInt32, and UInt64, that is, the unsigned integer types.


The string representation of the KeyDataViewType.

Applies to