Class

MLModel

An encapsulation of all the details of your machine learning model.

Overview

MLModel encapsulates a model's prediction methods, configuration, and model description.

In most cases, you can use Core ML without accessing the MLModel class directly. Instead, use the programmer-friendly wrapper class that Xcode automatically generates when you add a model (see Add a Model to Your Xcode Project). Use the model property from the wrapper class if your app needs the MLModel interface in addition to the wrapper class.

Use the MLModel interface to:

If your app downloads and compiles a model on the user's device, the MLModel interface is the only way for your app to use that model. See Downloading and Compiling a Model on the User's Device.

Topics

Creating a Model

modelWithContentsOfURL:error:

Creates a Core ML model object from a compiled model file.

modelWithContentsOfURL:configuration:error:

Creates a Core ML model object from a compiled model file and a custom configuration.

MLModelConfiguration

The settings for a model object.

Compiling a Model

compileModelAtURL:error:

Compiles a model on the device to update the model in your app.

Predicting Output Values

predictionFromFeatures:error:

Predicts output feature values from the given input feature values.

predictionFromFeatures:options:error:

Predicts output feature values from the given input feature values.

predictionsFromBatch:options:error:

Predicts output feature values from the given a batch of input feature values.

MLFeatureProvider

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

MLBatchProvider

An interface that represents a collection of feature providers.

MLPredictionOptions

The options available when making a prediction.

Inspecting a Model

configuration

The configuration of the model set during initialization.

modelDescription

Information about this model, intended for use during development, which is also displayed in the Xcode view of the model.

MLModelDescription

Information about a model, primarily the expected input and output format for each feature, and optional metadata.

Relationships

Inherits From

See Also

Machine Learning Model

Downloading and Compiling a Model on the User's Device

Distribute Core ML models to the user's device after the app is installed.

Making Predictions with a Sequence of Inputs

Integrate a recurrent neural network model to process sequences of inputs.