Create ML

Create machine learning models for use in your app.

Overview

Use Create ML with familiar tools like Swift and macOS playgrounds to create and train custom machine learning models on your Mac. You can train models to perform tasks like recognizing images, extracting meaning from text, or finding relationships between numerical values.

Diagram showing how you use images, text, and other structured data with Create ML to train a Core ML model.

You train a model to recognize patterns by showing it representative samples. For example, you can train a model to recognize dogs by showing it lots of images of different dogs. After you’ve trained the model, you test it out on data it hasn’t seen before, and evaluate how well it performed the task. When the model is performing well enough, you’re ready to integrate it into your app using Core ML.

Diagram showing the Create ML workflow: Gather data, train the model, and evaluate the trained model.

Create ML leverages the machine learning infrastructure built in to Apple products like Photos and Siri. This means your image classification and natural language models are smaller and take much less time to train.

Topics

Computer Vision

Creating an Image Classifier Model

Train a machine learning model to classify images, and add it to your Core ML app.

struct MLImageClassifier

A model you train to classify images.

struct MLObjectDetector

A model you train to detect objects within an image.

Natural Language Processing

Creating a Text Classifier Model

Train a machine learning model to classify natural language text.

struct MLTextClassifier

A model you train to classify natural language text.

struct MLWordTagger

A word tagging model you train to classify natural language text at the word level.

struct MLGazetteer

A collection of terms and their labels, which augments a tagger that analyzes natural language text.

struct MLWordEmbedding

A map of strings to a vector space that enable your app to find similar strings by looking at a string’s neighbors.

Sound Classification

struct MLSoundClassifier

A structure used to train a model to classify audio data programmatically.

Activity Classification

struct MLActivityClassifier

A model you train to classify activities based on motion sensor data.

Tabular Data

Model types for general tasks, such as labeling, estimating, or finding similarities. The models learn from columns of data values in a data table.

Creating a Model from Tabular Data

Train a machine learning model by using Core ML to import and manage tabular data.

enum MLClassifier

A model you train to classify data into discrete categories.

enum MLRegressor

A model you train to estimate continuous values.

struct MLRecommender

A model you train to make recommendations based on item similarity, grouping, and, optionally, item ratings.

struct MLDataTable

A table of data for training or evaluating a machine learning model.

enum MLDataValue

The value of a cell in a data table.

Visualizations

Global functions that create a visual representation of data tables and the columns within a data table.

func show(MLDataTable) -> MLStreamingVisualizable

Generates a streaming visualization of the data table.

func show<Element>(MLDataColumn<Element>) -> MLStreamingVisualizable

Generates a streaming visualization of the data column.

func show(MLUntypedColumn) -> MLStreamingVisualizable

Generates a streaming visualization of the untyped column.

func show(MLUntypedColumn, MLUntypedColumn) -> MLStreamingVisualizable

Generates a streaming plot visualization of the two untyped columns.

protocol MLVisualizable

An image visualization of machine learning types.

protocol MLStreamingVisualizable

A sequence of image visualizations for machine learning types.

Model Accuracy

Improving Your Model’s Accuracy

Use metrics to tune the performance of your machine learning model.

struct MLClassifierMetrics

Metrics used to evaluate a classifier’s performance.

struct MLRegressorMetrics

Metrics used to evaluate a regressor’s performance.

Supporting Types

Communal types that Create ML uses in all of its model-creation tasks.

struct MLModelMetadata

Information about a model that’s stored in a Core ML model file.

enum MLSplitStrategy

Data partitioning approaches, typically for creating a validation dataset from a training dataset.

enum MLCreateError

The errors Create ML throws while performing various operations, such as training models, making predictions, writing models to a file system, and so on.