Logo for tanaschita.com

Get started with Create ML to train a machine learning model in iOS

Learn how to use Create ML to create machinge learning models.

03 Apr 2023 · 4 min read

As mentioned in this developer guide on machine learning for iOS with Core ML, Apple's Create ML app allows us to train a model.

Create ML is part of Xcode's tool chain and allows us to train machinge learning models without requiring extensive knowledge of machine learning, for example allowing us to drag and drop datasets, choose an algorithm, and configure the model parameters through a graphical interface.

Let's look at how to do that.

Sponsorship logo
Preparing for a technical iOS job interview - updated for iOS 17
Check out my book on preparing for a technical iOS job interview with over 200 questions & answers. Test your knowledge on iOS topics such as Swift, SwiftUI, Combine, HTTP Networking, Authentication, SwiftData & Core Data, Concurrency with async/await, Security, Automated Testing, Machine Learning and more.
LEARN MORE

After opening Create ML, the application presents different templates to choose from. They can be used to train models for tasks such as image classification, object detection, text and sound classification, classification and regression of tabular data and more.

Create ML templates
Create ML templates

As an example, we'll work with the image classification template.

Let's say, we want to train a model which recognizes different weather conditions like rain, sunshine, sunset and clouds in photos.

To be able to train the model to do that, we need a labeled dataset of photos. The data set might look as follows:

Image classification data set
Image classification data set

As we can see above, the images are categorized in folders. The folder names represent the image labels.

After adding the data set, Create ML creates a class for each folder:

Create ML training
Create ML training

This is all we need to do to be able to start the training process by clicking the train button.

After the model training is completed, we can test the model with new data in the preview tab.

Create ML preview
Create ML preview

When satisfied with the model, we can save it as a .mlmodel file from the output tab and integrate it into our iOS application. To learn how to do that, check out this article on machine learning for iOS with Core ML.

Sponsorship logo
Preparing for a technical iOS job interview - updated for iOS 17
Check out my book on preparing for a technical iOS job interview with over 200 questions & answers. Test your knowledge on iOS topics such as Swift, SwiftUI, Combine, HTTP Networking, Authentication, SwiftData & Core Data, Concurrency with async/await, Security, Automated Testing, Machine Learning and more.
LEARN MORE

Newsletter

Image of a reading marmot
Subscribe

Like to support my work?

Say hi

Related tags

Articles with related topics

machine learning

swift

ios

Quick tip on how to split text into words with the Natural Language framework in Swift.

Learn how the tokenizer of the Natural Language framework works.

19 Jun 2023 · 2 min read

Latest articles and tips

© 2024 tanaschita.com

Privacy policy

Impressum