iOS & Swift

Machine Learning by Tutorials

The best book on machine learning for iOS. Covers CoreML, Vison, image and sequence classifiers, natural language processing, and more! By Alexis Gallagher, Audrey Tam, Matthijs Hollemans & Chris LaPollo.

Read for Free with the Personal Plan* * Includes this and all other books in our online library See all benefits
Buy Individually $59.99* *Includes access to all of our online reading features.
Leave a rating/review
Download materials
Buy paperback—Amazon Comments
Save for later

Who is this for?

This books is for the intermediate iOS developer who already knows the basics of iOS and Swift development, but wants to understand how machine learning works.

Covered concepts

  • CoreML
  • Create ML
  • Turi Create and Keras
  • Image Classification
  • Convolutional Networks
  • Sequence Classification
  • Text-to-text Transform
Get started with Machine Learning for Apple and iOS!

Want to know a secret? Machine learning isn’t really that hard to learn. The truth is, you don’t need a PhD from a prestigious university or a background in mathematics to do machine learning. If you already know how to code,...


Before You Begin

This section tells you a few things you need to know before you get started, such as what you’ll need for hardware and software, where to find the project files for this book, and more.

Section I: Machine Learning with Images

This section introduces you to the world of machine learning. You’ll get a high level view of what it is, and how it can be used on mobile. You’ll also get a quick primer on using Python for machine learning. You’ll learn how to set up an environment to use tools such as CreateML, Turi Create, and Keras for machine learning. Finally, you’ll learn how to use machine learning techniques to solve problems using images. The topics you’ll explore include image classification, object detection with bounding boxes, and object segmentation.

Toggle description
In this introduction chapter, you’ll learn what machine learning is all about. You’ll touch on everything from, the difference between supervised and unsupervised learning, to what transfer learning is. You’ll even go over the ethics of machine learning, and how bias can affect models.
In this chapter, you’ll build your first iOS app by adding a CoreML model to detect whether a snack is healthy or unhealthy. You’ll focus on how machine learning can be used to solve classification problems such as trying to identify what an object might be.
Toggle description
In this chapter, you’ll start to build your first machine learning model using Create ML. You’ll be introduced to the dataset used to create the model, along with how Create ML uses transfer learning to get amazing classification results. Moreover, you’ll learn what it means to evaluate the performance of your model.
In this chapter, you’ll get a quick primer on Python. You’ll learn how to setup your Python environment using Conda, and how to install external libraries. You’ll learn how to run and use Jupyter notebooks to iterate quickly with Python.
Toggle description
In this chapter, you’ll learn to use Turi Create to build a classification model. You’ll use the snacks dataset to create your model. You’ll learn how to analyze your model’s performance, and how to go under the hood with Turi Create in order to improve your model.
In this chapter, you’ll learn to how to take control of your model’s training with Keras. You’ll design your first neural network, and how to pass your dataset into Keras for training.
Toggle description
In this chapter, you’ll learn why a simple neural network might not be enough when it comes to solving problems with images using machine learning. You’ll learn about how using a convolutional neural network provides a better approach to solving classification problems.
In this chapter, you’ll learn about advanced model architectures used for solving image classification. You’ll learn how you can use Keras to do transfer learning, and how applying advanced techniques such as dropout and regularization can improve your model’s performance.
Toggle description
In this chapter, you’ll learn how to identify an object’s location in an image. You’ll learn how to build a simple localization model that predicts a single bounding box.
Toggle description
In this final chapter, you’ll learn about some advanced localization models. You’ll learn about one-shot detectors like YOLO and SSD and how they can be used to identify multiple objects in an image. You’ll also learn about how machine learning can be used for segmentation to separate an object from its background.

Section II: Machine Learning with Sequences

In this section, you’ll learn how to apply machine learning to sequential data. You’ll work on a new iOS app which attempts to identify a user’s activity using data from their iPhone’s motion sensors. In the process, you’ll learn how to build a good training dataset, how to create an activity classification model using Turi Create, and how to incorporate your model into an iOS app to support responsive classifications with real-time data.

In this chapter, you’ll learn how working with sequences differs from working with discrete data like individual images. You’ll learn how to collect iPhone sensor data, as well as what it takes to build a good training dataset.
In this chapter, you’ll learn about neural networks designed to work with sequences. You’ll also learn how to use Turi Create to train an activity classification model using data from the previous chapter.
Toggle description
In this chapter, you’ll learn how to pass real-time sequential data captured from a device’s motion sensors into your Core ML model. You’ll learn some tricks to help keep your apps responsive and accurate while processing sequences of streaming data.

Section III: Natural Language Processing

In this section, you’ll focus on a specific type of sequential data — natural language text. You’ll learn how to use Apple-provided APIs to perform common language processing tasks. You’ll also learn how to use text with neural networks, and you’ll create a model with Keras that translates text from Spanish to English. Finally, you’ll read about advanced techniques that you can experiment with to improve your model.

Toggle description
In this chapter, you’ll learn how to use Apple’s Natural Language framework to handle several useful text-related tasks. You’ll explore this API in the context of a movie review app that supports multiple languages.
In this chapter, you’ll learn about sequence-to-sequence models and how you can use them to do things like language translation. You’ll build a model with Keras that attempts to translate Spanish-language movie reviews into English.
This chapter introduces additional techniques you can use to improve the performance of your sequence-to-sequence models.