MLModel

abstract class NatML.MLModel : IDisposable

The MLModel class abstracts a machine learning model, containing a computation graph for making predictions along with feature type information and metadata.

Inspecting Feature Types

Models provide information about their expected input and output feature types. This type information is crucial for writing model predictors.

Input Features

/// <summary>
/// Model input feature types.
/// </summary>
MLFeatureType[] inputs { get; }

The model provides its expected input feature types. This information is crucial in order to create input features for predictions. Typically, a predictor will handle any necessary conversions of your input feature so that it matches the type that the model expects.

circle-info

The inputs are reported in the same order that they are expected by the model when making predictions.

Output Features

/// <summary>
/// Model output feature types.
/// </summary>
MLFeatureType[] outputs { get; }

The model provides its output feature types. This information is crucial in order to convert the model's raw outputs into more usable forms by predictors.

circle-info

The outputs are reported in the same order that they are produced by the model when making predictions.

Inspecting Metadata

Models expose metadata that was defined when they were created.

Disposing the Model

Models can consume native and cloud resources, including threads, memory allocators, and so on. As a result, you must dispose of the model once you are done using it.

circle-info

The MLModel class implements the IDisposablearrow-up-right interface, and as such can be used with using blocks.

triangle-exclamation

Last updated