An interface that represents a collection of values for either a model's input or its output.
- iOS 11.0+
- macOS 10.13+
- tvOS 11.0+
- watchOS 4.0+
- Core ML
MLFeature to customize the way your app gets data to and from your model when the model's dynamically generated interface doesn't meet your app's needs.
Consider adopting this protocol in your data source if any of the following apply:
Your data is collected asynchronously.
Using the autogenerated interface leads to copying excessive amounts of data.
Your data source is otherwise complicated.
The interface is mainly an accessor for
MLFeature instances, making it straightforward to implement. Adopting this protocol allows you to integrate your data directly with
MLModel, which means the model can query your data sources without constructing a separate input instance.
To customize your app's interaction with a model:
MLFeatureprotocol in a class or structure so that the model can query it for input feature values via
MLFeaturereturned from a
prediction(from:)method to get the output feature values for that prediction.