days
0
-62
-2
hours
-1
-9
minutes
-5
-5
seconds
-1
-3
Check out the latest:
ML 101

# A basic introduction to Machine Learning

With all the hype around machine learning, there’s plenty of people asking what it is exactly. If you want a quick primer on what’s important, read this.

The main goal of machine learning is to study, engineer, and improve mathematical models which can be trained with context-related data (provided by a generic environment), to infer the future and to make decisions without complete knowledge of all influencing elements (external factors). In other words, an agent (which is a software entity that receives information from an environment, picks the best action to reach a specific goal, and observes the results of it) adopts a statistical learning approach, trying to determine the right probability distributions and use them to compute the action (value or decision) that is most likely to be successful (with the least error)

I prefer using the term inference instead of prediction. This only avoids the weird (but not uncommon) idea that machine learning is a sort of modern magic. Moreover, it’s possible to introduce a fundamental statement: an algorithm can extrapolate general laws and learn their structure with relatively high precision only if they affect the actual data. So the term prediction can be freely used, but with the same meaning adopted in physics or system theory. Even in the most complex scenarios, such as image classification with convolutional neural networks, every piece of information (geometry, color, peculiar features, contrast, and so on) is already present in the data and the model has to be flexible enough to extract and learn it permanently.

## Different types of Machine Learning

Let’s take a look at a number of different machine learning models, beginning with supervised learning.

### Supervised learning

In supervised learning, algorithms run on a training set that is made up of input and expected output. Starting from this information, the agent will gradually correct its parameters which in turn reduces the magnitude of a global loss function. After each iteration, if the algorithm is flexible enough and data elements are coherent, the overall accuracy increases and the difference between the predicted and expected value becomes close to zero. Of course, in a supervised scenario, the goal is training a system that must also work with samples it has never seen before. This makes it necessary to allow the model to develop a generalization ability and avoid a common problem called overfitting, which causes an over-learning due to an excessive capacity (we’re going to discuss this in more detail in the next chapters, however we can say that one of the main effects of such a problem is the ability to predict correctly only the samples used for training, while the error for the remaining ones is always very high).

Examples of machine learning applications include:

• Predictive analysis that’s based on regression or categorical classification
• Spam detection
• Pattern detection
• Natural language processing
• Sentiment analysis
• Automatic image classification
• Automatic sequence processing (as in music or speech)

### Unsupervised learning

Unsupervised learning is, as the name suggests, based on the absence of any supervisor and therefore of absolute error measures. It’s useful when it’s necessary to learn how a set of elements can be grouped (clustered) according to their similarity (or distance measure).

There are a number of different ways unsupervised learning is applied in the world, such as:

• Segmenting different objects (like films or songs)
• Similarity detection (like plagiarism checkers)
• Automatic labelling

SEE ALSO: Machine learning and data sovereignty in the age of GDPR

### Reinforcement learning

Even if there are no actual supervisors, reinforcement learning is also based on feedback provided by the environment. However, in this case, the information is more qualitative and doesn’t help the agent in determining a precise measure of its error. In reinforcement learning, this feedback is usually called reward (sometimes, a negative one is defined as a penalty) and it’s useful to understand whether a certain action performed in a state is positive or not. The sequence of most useful actions is a policy that the agent has to learn, so to be able to make always the best decision in terms of the highest immediate and cumulative reward. In other words, an action can also be imperfect, but in terms of a global policy it has to offer the highest total reward. This concept is based on the idea that a rational agent always pursues the objectives that can increase his/her wealth. The ability to see over a distant horizon is a distinction mark for advanced agents, while short-sighted ones are often unable to correctly evaluate the consequences of their immediate actions and so their strategies are always sub-optimal.

Reinforcement learning is particularly efficient when the environment is not completely deterministic, when it’s often very dynamic, and when it’s impossible to have a precise error measure. During the last few years, many classical algorithms have been applied to deep neural networks to learn the best policy for playing Atari video games and to teach an agent how to associate the right action with an input representing the state (usually a screenshot or a memory dump).

This piece has been taken from Machine Learning Algorithms.

Machine learning is all the rage these days and if your company is not in the conversation, perhaps you want to hear how trivago, BigML, Studio.ML, Udacity, AWS and Skymind put this technology to good use.

We recently talked about the importance of ethics education among developers so now it’s time to have the “how to develop ML responsibly” talk with you. Last but not least, if you thought machine learning and DevOps don’t mix well, think again.

I wish you a happy reading!

Author

Richard Gall

Richard Gall is Communications Manager at Packt, utilising his background in writing and publishing to help Packt in their mission to help the world put software to work in new ways. Packt, one of the biggest tech publishers in the world, deliver effective learning and information services to IT professionals.