Use of Machine Learning in Sport

Sport is the activity that mainly has as its objective the improvement of themselves and their performances, this improvement is only the journey that has as its goal the realization of its maximum potential. Along this infinite daily journey, athletes use an infinite number of methods to achieve this goal such as a better diet, tracking their performance to improve them and more. One of the tools that can be used to obtain significant results is the use of the various technologies that we can use with extreme ease. One of the technologies that can be most used for the significant improvement of one’s performance is Machine Learning.

What is machine learning?

Machine learning is the application of an artificial intelligence that provides the system’s ability to learn automatically and learn from experience without explicitly programming the learning algorithm.

How can artificial intelligence learn something and repeat it over time? Essentially the learning methods are:

Supervised learning

Unsupervised learning

Reinforced learning

Supervised learning is a modality that aims to instruct a computer system to allow it to automatically elaborate predictions on the output values ​​of a system concerning an input based on a series of ideal examples, consisting of input and output pairs, which are initially provided to him.

Unsupervised learning is a method that consists in providing the computer system with a series of inputs (system experience) which he will reclassify and organize based on common characteristics to try to make reasonings and predictions on subsequent inputs. As opposed to supervised learning, only non-annotated examples are provided to the apprentice during learning, as the classes are not known a priori but must be learned automatically.

Reinforcement learning is a method that aims to create autonomous agents capable of choosing actions to be carried out for the achievement of certain objectives through interaction with the environment in which they are immersed.

Machine Learning in iOS

Apple provides developers with a series of really interesting tools to facilitate the development of machine learning models for your device ecosystem. The most interesting are CoreML and CreateML

Core ML

Core ML allows you can create your own customized machine learning models. This can be any model, from pre-made ones that can be found on the Internet to models that can be trained from scratch. You can use Core ML to load models and then combine them with Vision or Natural Language for things like object recognition or natural language processing or with many other frameworks. Besides, Apple provides a series of ready-to-use models that the user has available for modifying these and creating ever-new models.

Create ML

While Core ML allows you to use your models, CreateML allows you to create them from the data you have. CreateML is optimized for macOS and is integrated with Xcode playgrounds, so it’s the easiest way for iOS developers to train their machine learning models, simply by organizing their data frame.

Machine learning in sports

Machine learning in sport is continuously used for the most varied uses, creating a branch in its own right like Sports analytics. Sports Analytics differs in various areas such as

Sports Analytics is the process that identifies and acquires knowledge and insight into the performance of potential players based on the use of a variety of data sources such as game data and individual player performance data. This advanced and sophisticated type of analysis should be able to extract valuable usable information that coaches can use.

Sports Analytics can be used in infinite ways including:

  • Predict the outcome of a game
  • Predict the performance of teams or individual players
  • Creation of new strategies for upcoming competitions

Our learning journey

The goal of our challenge was to investigate the possible areas of development of machine learning in the sports environment using iOS devices. We subsequently decided to focus on tennis as it offered a roaster of less complex movements than other actions present within other sports.

Our goal was to create a project that was able to record certain movements, insert them into files that will be studied through machine learning algorithms for the search for the best possible performance.

The study process

To study the improvement of certain movements we have chosen the less complex movements for an initial study, for this reason, we have chosen tennis for the study of forehand and backhand.

The first phase had the goal of creating this project on iPhone and Watch that would record all the movements made. To do this we used the CoreMotion framework using the oscilloscope and accelerometer sensors. Once recorded, the movements are automatically saved within a CSV file.

The second phase is the creation of the model that cannot be updated thanks to CreateML. Starting from the CSV files obtained from the recordings of numerous movements, we have divided these into different folders for the correct creation of the data frame consisting of the training data, validation data and testing data. Once we have organized our files we can start training our first machine learning model.

Following the creation of the first model that cannot be updated through CoreML, we made it upgradeable thanks to a python script that uses CoreMLTools as a framework.

Once the model was updated, we implemented it within the project and made it possible to use new data within the model to re-train it from the device.

Resources:

--

--