MLFeatureType

abstract class MLFeatureType

The MLFeatureType class is an abstract base class providing information that fully describes the structure of an MLFeature.

Every MLFeature has a corresponding MLFeatureType.

Inspecting the Name

/**
 * Feature name.
 */
name: string | undefined;

Some feature types include a name. This is usually the case with feature types provided by MLModel instances. However, most feature types attached to features do not have a name.

Inspecting the Data Type

/**
 * Feature data type.
 */
type: MLDataType;

This is the data type of each element within a given feature. This is usually a signed numeric type. Below are possible values:

// Feature data type.
enum MLDataType {
    // Single precision floating point number.
    Float = "FLOAT32",
    // Double precision floating point number.
    Double = "FLOAT64",
    // Signed 8-bit integer.
    SByte = "INT8",
    // Signed 16-bit integer.
    Short = "INT16",
    // Signed 32-bit integer.
    Int = "INT32",
    // Signed 64-bit integer.
    Long = "INT64",
    // Unsigned 8-bit integer.
    Byte = "UINT8",
    // Unsigned 16-bit integer.
    UShort = "UINT16",
    // Unsigned 32-bit integer.
    UInt = "UINT32",
    // Unsigned 64-bit integer.
    ULong = "UINT64",
    // Encoded image.
    Image = "IMAGE",
    // Encoded audio.
    Audio = "AUDIO",
    // Plain text.
    String = "STRING"
}

Last updated