Unity
Search
K

IMLPredictor

interface NatML.IMLPredictor<TOutput> : IDisposable
Predictors are lightweight primitives for making predictions with one or more MLModel instances. The IMLPredictor interface is designed specifically for working with Edge ML models, which make predictions on-device.

Making Predictions

/// <summary>
/// Make a prediction on one or more input features.
/// </summary>
/// <param name="inputs">Input features.</param>
/// <returns>Prediction output.</returns>
TOutput Predict (params MLFeature[] inputs);
This is where the magic happens. The predictor should convert input features into MLEdgeFeature (for edge predictions) or MLCloudFeature instances depending on the type of the underlying model. Once the prediction is completed by the model, the predictor should then transform the output features into types that are easily consumed by applications.
See MLEdgeModel for more information on implementing edge predictors.
See MLCloudModel for more information on implementing cloud predictors.