MLFeature
abstract class NatML.MLFeature
The MLFeature class is an abstract base class representing input and output features used in making predictions. All predictors accept one or more features, which are then provided to the model to make predictions.
Creating a Feature
NatML provides implicit conversions from common data types into MLFeature instances:
From an Array
// With a `float` array
float[] array = ...;
// Create a feature
MLFeature feature = array;
// Then make a prediction
predictor.Predict(feature);
// This works too
predictor.Predict(array);NatML provides an implicit conversion from a float[] to an MLArrayFeature.
When this conversion is used, the created feature will have no shape information.
From a Texture2D
// With a `Texture2D`
Texture2D texture = ...;
// Create a feature
MLFeature feature = texture;
// Then make a prediction
predictor.Predict(feature);
// This works too
predictor.Predict(texture);NatML provides an implicit conversion from a Texture2D to an MLImageFeature.
From a WebCamTexture
NatML provides an implicit conversion from a WebCamTexture to an MLImageFeature.
From an AudioClip
NatML provides an implicit conversion from an AudioClip to an MLAudioFeature.
From a String
NatML provides an implicit conversion from a string to an MLTextFeature.
Inspecting the Feature
Every feature has a corresponding MLFeatureType that provides information about the feature's shape, data type, and so on.
Last updated
Was this helpful?