Protocol

MLFeatureProvider

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

Overview

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.

Topics

Accessing Values

func featureValue(for: String)

Accesses the value of the named feature.

Required.

var featureNames: Set<String>

The set of valid feature names.

Required.

Relationships

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.