Book Image

Machine Learning with Swift

By : Jojo Moolayil, Alexander Sosnovshchenko, Oleksandr Baiev
Book Image

Machine Learning with Swift

By: Jojo Moolayil, Alexander Sosnovshchenko, Oleksandr Baiev

Overview of this book

Machine learning as a field promises to bring increased intelligence to the software by helping us learn and analyse information efficiently and discover certain patterns that humans cannot. This book will be your guide as you embark on an exciting journey in machine learning using the popular Swift language. We’ll start with machine learning basics in the first part of the book to develop a lasting intuition about fundamental machine learning concepts. We explore various supervised and unsupervised statistical learning techniques and how to implement them in Swift, while the third section walks you through deep learning techniques with the help of typical real-world cases. In the last section, we will dive into some hard core topics such as model compression, GPU acceleration and provide some recommendations to avoid common mistakes during machine learning application development. By the end of the book, you'll be able to develop intelligent applications written in Swift that can learn for themselves.
Table of Contents (18 chapters)
Title Page
Packt Upsell
Contributors
Preface
Index

Improving our solution


There are several directions in which we can proceed to improve our algorithm for motion recognition.

Probabilistic interpretation

The CMMotionActivity class provides a confidence level for each predicted motion type. We can also add this feature to our algorithm. Instead of returning one label, we can return the proportion of labels among neighbors.

More data sources

We've used only accelerometer, but we could use gyroscope and magnetometer also. This can be done in several ways: you can just merge three time series into one three-dimensional time series or you can train an ensemble of three independent classifiers.

We've also merged x, y, and z of accelerometer into one magnitude value, but you can try to use them as separate time series. In this case, for three motion sensors, you'd have nine time series.

Smarter time series chunking

We split our time series into chunks of 25 elements length. This introduces delay when the motion type changes from one to another. This...