Mobile AI Through Machine Learning Algorithms

Tuesday 2/12/19 09:00am
|
Posted By Enrico Ros
  • Up0
  • Down0

Snapdragon and Qualcomm branded products are products of
Qualcomm Technologies, Inc. and/or its subsidiaries.

Machine learning (ML) is a method of artificial intelligence (AI) in which data is used to train a machine so that it can make decisions or predictions on its own. In a previous blog, Setting up your machine learning projects for success, we discussed how data and modelling play a key role in allowing a machine to learn and improve, and our e-book explains how ML fits into the bigger picture of AI.

An ML algorithm is a key element that ties this all together, and as we’ll discover in this blog, there are four main categories of ML algorithms – supervised machine learning, unsupervised machine learning, semi-supervised machine learning, and reinforcement machine learning.

Supervised Machine Learning

Many of today’s ML algorithms can be considered supervised, which means the model is iteratively trained by running the algorithm and comparing its output against data that is known to be correct. Once training is complete, the algorithm and model are ready for inference.

There are two general types of problems solved by supervised algorithms:

  • Classification: data is classified and labelled, and the output indicates the probability that a given input belongs to one or more categories (e.g., different shapes).
  • Regression: data is analyzed, and the output is a real value (e.g., x dollars, y kilograms, etc.).

One of the hottest supervised algorithms at the moment is the neural network, which can handle both classification and regression problems. A neural network mimics the neurons and connections of the brain, which are trained by repeatedly showing labelled data instances, computing the most probable result out of the possible categories, working backwards through the model to adjust the weights of the various connections, and then repeating the process until the algorithm consistently provides correct results.

Neural networks typically perform vector and matrix calculations on large datasets, which require a platform that can perform these operations quickly. In a wireless edge architecture, these training calculations are typically performed in the cloud to take advantage of server-side processing power. Inference can then be done on edge devices such as those powered by a Snapdragon® mobile platform. Developers can use the Qualcomm® Neural Processing SDK for vector and matrix math across the Qualcomm® Hexagon™ 685 Vector DSP, GPU, and/or CPU. This also allows for the use of popular frameworks such as TensorFlow and Caffe2 and the ONNX format, which have been optimized for Snapdragon mobile platforms.

Unsupervised Machine Learning

Compared with supervised ML algorithms, unsupervised ML algorithms have no known correct answers to compare against. Instead, they attempt to uncover the structure or distribution of the data to better understand it, and to react according to the presence or absence of commonalities within the data. Unsupervised ML algorithms can be sub-categorized as follows:

  • Clustering is where data is grouped and labelled. For example, the K-means algorithm uses centroids that capture the data points surrounding them, such as customers grouped by purchase behavior.
  • Association refers to rules that are identified, and describe patterns in large quantities of data. For example, the Apriori algorithm uncovers associations in a dataset such as the probabilities that customers who buy a certain product also tend to buy other specific products. The algorithm reduces subsets and supersets of data items with low probabilities, to uncover datasets that exhibit patterns of interest.
  • Anomaly detection is when unusual data points are detected from a large dataset. This can be implemented using various statistical algorithms such as a simple moving average or low-pass filter. For this to be accurate, the dataset on which the algorithm operates must contain a large number of normal examples and a small number of anomalies. This is useful for cases such as fraud detection, where anomalies can’t be discretely classified and may vary in the future.

Semi-supervised Machine Learning

Supervised and unsupervised ML algorithms can also be combined to form semi-supervised ML algorithms. This is often done when the dataset contains both labelled and unlabelled data.

Reinforcement Machine Learning

Reinforcement ML algorithms seek to find an action model that maximizes the cumulative reward for an agent, factoring in both short and long-term rewards. An agent is an entity in an environment consisting of states that can perform actions in those states. The agent is trained by receiving a reward or punishment (e.g., an increase or decrease in score) based on the outcome of its actions for a given state, where the allowable actions are defined using a policy map.

Reinforcement ML can be implemented as a Markov Decision Process (MDP), in which sequential actions are performed in a known environment. This requires only the current state and action to determine the state transition and the reward/punishment. Such processes have been used to make a computer successfully play a video game on its own, where the player is the agent and the game world is the environment. In this case, the moves that the player can make are the actions, and the rendered graphic frame is the current state.

When applying reinforcement ML in an unknown environment (e.g., developing actions for a self-driving car), an algorithm such as Q-learning can be used to explore all possible state-action combinations, to estimate the longer-term reward.

Reinforcement ML requires data generated from an environment or a simulation, well-defined reward and punishment policies, and sufficient processing power. Note too that reinforcement ML can involve both supervised and unsupervised ML algorithms to map input to output. See Efficient Reinforcement Learning for Automating Human Decision-Making in SoC Design for more information on balancing power consumption and performance when running reinforcement ML on mobile.

Conclusion

There are a growing number of ML algorithms, but most of them fall under the categories listed above. Technologies like Snapdragon mobile platforms, the Qualcomm Neural Processing SDK, and supported frameworks, can help developers bring these algorithms to mobile. We’d love to hear how you have been using solutions from Qualcomm Technologies, Inc. for mobile AI.