An interface that represents a collection of feature values for a model.


If you have a more complex data source, consider adding this protocol to your data source. The interface is straightforward to implement, being mainly an accessor for feature values. By implementing the protocol, you allow the MLModel to query your data sources without constructing a separate input instance. If your data is collected asynchronously, implement this protocol on your data structure. Or, if using the autogenerated interface leads to copying excessive amounts of data, use this protocol to integrate your data directly with the MLModel.


Accessing Values

func featureValue(for: String) -> MLFeatureValue?

Accesses the value of the named feature.


var featureNames: Set<String>

The set of valid feature names.



See Also

Model Features

class MLDictionaryFeatureProvider

A convenience wrapper for the given dictionary of data.

class MLFeatureValue

An immutable instance representing a feature's type and value.

class MLFeatureDescription

A description of a feature.

class MLMultiArray

A multidimensional array used as input or output for a model.

class MLSequence

A sequence of data used as input or output for a model.

protocol MLBatchProvider

An interface that represents a collection of feature providers.

class MLArrayBatchProvider

A convenience wrapper for batches of feature providers.