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` arrayfloat[]array=...;// Create a featureMLFeaturefeature=array;// Then make a predictionpredictor.Predict(feature);// This works toopredictor.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`Texture2Dtexture=...;// Create a featureMLFeaturefeature=texture;// Then make a predictionpredictor.Predict(feature);// This works toopredictor.Predict(texture);