---
title: MLFeatureProvider
framework: coreml
role: symbol
role_heading: Protocol
path: coreml/mlfeatureprovider
---

# MLFeatureProvider

An interface that represents a collection of values for either a model’s input or its output.

## Declaration

```swift
protocol MLFeatureProvider
```

## Overview

Overview Use MLFeatureProvider 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 MLFeatureValue 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: Adopt the MLFeatureProvider protocol in a class or structure so that the model can query it for input feature values via featureValue(for:). Pass your app’s MLFeatureProvider to your MLModel with prediction(from:) or prediction(from:options:). Use the MLFeatureProvider returned from a prediction(from:) method to get the output feature values for that prediction.

## Topics

### Accessing values

- [featureValue(for:)](coreml/mlfeatureprovider/featurevalue(for:).md)
- [featureNames](coreml/mlfeatureprovider/featurenames.md)

## Relationships

### Conforming Types

- [MLDictionaryFeatureProvider](coreml/mldictionaryfeatureprovider.md)

## See Also

### Model inputs and outputs

- [Making Predictions with a Sequence of Inputs](coreml/making-predictions-with-a-sequence-of-inputs.md)
- [MLFeatureValue](coreml/mlfeaturevalue.md)
- [MLSendableFeatureValue](coreml/mlsendablefeaturevalue.md)
- [MLDictionaryFeatureProvider](coreml/mldictionaryfeatureprovider.md)
- [MLBatchProvider](coreml/mlbatchprovider.md)
- [MLArrayBatchProvider](coreml/mlarraybatchprovider.md)
- [MLModelAsset](coreml/mlmodelasset.md)
