KeyDataViewType Class


This type is for data representing some enumerated value. This is an enumeration over a defined, known cardinality set, as expressed through Count. The underlying .NET type is one of the unsigned integer types. Most commonly this will be UInt32, but could alternately be Byte, UInt16, or UInt64. Despite this, the information is not inherently numeric, so, typically, arithmetic is not meaningful. For example, in multi-class classification, the label is typically a class number which is naturally a KeyDataViewType.

Note that for data of this type, a value of 0, being the default value of the representation type, indicates the missing value since it would not be sensible for the default value to correspond to any one particular specific value of the set. The first non-missing value for the enumeration of the set is always 1.

For instance, if you had a key value with a Count of 3, then the UInt32 value 0 would correspond to the missing key value, and one of the values of 1, 2, or 3 would be one of the valid values, and no other values should in principle be used.

Note that in usage and structure, this is quite close in intended usage and structure to so-called "factor variables" in R.

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


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