Machine Learning Tutorial for Beginners: What is, Basics of ML
⚡ Smart Summary
Machine Learning is a family of computer algorithms that improve from examples instead of being explicitly coded, combining data with statistical tools to predict outputs that people can turn into actionable decisions.
What is Machine Learning?
Machine Learning is a system of computer algorithms that can learn from examples through self-improvement, without being explicitly coded by a programmer. Machine learning is a part of artificial intelligence which combines data with statistical tools to predict an output that can be used to make actionable insights.
The breakthrough comes with the idea that a machine can learn from the data (i.e., examples) on its own to produce accurate results. Machine learning is closely related to data mining and Bayesian predictive modeling. The machine receives data as input and uses an algorithm to formulate answers.
A typical machine learning task is to provide a recommendation. For those who have a Netflix account, all recommendations of movies or series are based on the user’s historical data. Tech companies use unsupervised learning to improve the user experience by personalizing recommendations.
Machine learning is also used for a variety of tasks such as fraud detection, predictive maintenance, portfolio optimization, and task automation.
Machine Learning vs. Traditional Programming
Traditional programming differs significantly from machine learning. In traditional programming, a programmer codes all the rules in consultation with an expert in the industry for which the software is being developed. Each rule is based on a logical foundation; the machine produces an output by following the logical statement. When the system grows complex, more rules need to be written, and it can quickly become unsustainable to maintain. The diagram below shows that flow, where data and hand-written rules go in and answers come out.

Machine learning is meant to overcome this issue. The machine learns how the input and output data are correlated, and it writes the rule itself. Programmers do not need to write new rules each time there is new data. The algorithms adapt in response to new data and experience to improve efficacy over time. The second diagram inverts the first one: data and known answers go in, and the rule comes out.
How does Machine Learning Work?
With that contrast in place, the next question is what actually happens inside the learning step.
Machine learning is the brain where all the learning takes place. The way the machine learns is similar to the way a human being does. Humans learn from experience: the more we know, the more easily we can predict. By analogy, when we face an unknown situation, the likelihood of success is lower than in a known situation. Machines are trained the same way. To make an accurate prediction, the machine sees an example. When we give the machine a similar example, it can figure out the outcome. However, like a human, if it is fed a previously unseen example, the machine has difficulty predicting.
The core objectives of machine learning are learning and inference. First of all, the machine learns through the discovery of patterns, and that discovery is made possible by the data. One crucial part of the data scientist’s job is to choose carefully which data to provide to the machine. The list of attributes used to solve a problem is called a feature vector. You can think of a feature vector as a subset of data that is used to tackle a problem.
The machine uses algorithms to simplify reality and transform this discovery into a model. The learning stage is therefore used to describe the data and summarize it into a model, as illustrated below.
For instance, the machine is trying to understand the relationship between the wage of an individual and the likelihood of going to a fancy restaurant. It turns out the machine finds a positive relationship between wage and going to a high-end restaurant: this is the model.
Inferring
When the model is built, it is possible to test how powerful it is on never-seen-before data. The new data is transformed into a feature vector, goes through the model and gives a prediction. This is the valuable part of machine learning. There is no need to update the rules or train the model again — you can use the previously trained model to make an inference on new data, exactly as the diagram below shows.
The life of a machine learning program is straightforward and can be summarized in the following points:
- Define a question
- Collect data
- Visualize data
- Train algorithm
- Test the algorithm
- Collect feedback
- Refine the algorithm
- Loop through steps 4 to 7 until the results are satisfying
- Use the model to make a prediction
Once the algorithm gets good at drawing the right conclusions, it applies that knowledge to new sets of data.
Machine Learning Algorithms and Where they are Used?
The chart below groups the most common algorithms by the kind of task they solve.
Machine learning can be grouped into two broad learning tasks: supervised and unsupervised. Two further families sit between and beyond them — semi-supervised learning, which mixes a small labelled set with a large unlabelled one, and reinforcement learning, where an agent learns from rewards rather than from labelled answers.
Supervised learning
An algorithm uses training data and feedback from humans to learn the relationship between given inputs and a given output. For instance, a practitioner can use marketing expense and weather forecast as input data to predict the sales of cans.
You can use supervised learning when the output data is known. The algorithm will then predict on new data.
There are two categories of supervised learning:
- Classification task
- Regression task
Classification
Imagine you want to predict the gender of a customer for a commercial. You will start by gathering data on height, weight, job, salary, purchasing basket and so on from your customer database. You know the gender of each of your customers, and it can only be male or female. The objective of the classifier is to assign a probability of being male or female (i.e., the label) based on the information you have collected (i.e., the features). When the model has learned how to recognize male or female, you can use new data to make a prediction. For instance, you have just received new information from an unknown customer, and you want to know whether the customer is male or female. If the classifier predicts male = 70%, it means the algorithm is 70% sure that this customer is male, and 30% sure the customer is female.
The label can have two or more classes. The above machine learning example has only two classes, but if a classifier needs to predict objects, it may have dozens of classes (e.g., glass, table, shoes — each object represents a class).
Regression
When the output is a continuous value, the task is a regression. For instance, a financial analyst may need to forecast the value of a stock based on a range of features such as equity, previous stock performance and macroeconomic indices. The system will be trained to estimate the price of the stock with the lowest possible error.
The table below lists the supervised algorithms you will meet most often, and the task each one is suited to.
| Algorithm | Description | Type |
|---|---|---|
| Linear regression | Finds a way to correlate each feature to the output to help predict future values. | Regression |
| Logistic regression | Extension of linear regression that’s used for classification tasks. The output variable is binary (e.g., only black or white) rather than continuous (e.g., an infinite list of potential colors) | Classification |
| Decision tree | Highly interpretable classification or regression model that splits data-feature values into branches at decision nodes (e.g., if a feature is a color, each possible color becomes a new branch) until a final decision output is made | Regression Classification |
| Naive Bayes | The Bayesian method is a classification method that makes use of the Bayesian theorem. The theorem updates the prior knowledge of an event with the independent probability of each feature that can affect the event. | Regression Classification |
| Support vector machine | Support Vector Machine, or SVM, is typically used for the classification task. The SVM algorithm finds a hyperplane that optimally divides the classes. It is best used with a non-linear solver. | Regression (not very common) Classification |
| Random forest | The algorithm is built upon a decision tree to improve the accuracy drastically. Random forest generates many simple decision trees and uses the ‘majority vote’ method to decide which label to return. For the classification task, the final prediction will be the one with the most votes; for the regression task, the average prediction of all the trees is the final prediction. | Regression Classification |
| AdaBoost | Classification or regression technique that uses a multitude of models to come up with a decision but weighs them based on their accuracy in predicting the outcome | Regression Classification |
| Gradient-boosting trees | Gradient-boosting trees is a state-of-the-art classification/regression technique. It focuses on the error committed by the previous trees and tries to correct it. | Regression Classification |
Unsupervised learning
In unsupervised learning, an algorithm explores input data without being given an explicit output variable (e.g., it explores customer demographic data to identify patterns).
You can use it when you do not know how to classify the data and you want the algorithm to find the patterns and group the data for you. The main unsupervised algorithms are summarized below.
| Algorithm Name | Description | Type |
|---|---|---|
| K-means clustering | Puts data into some groups (k) that each contains data with similar characteristics (as determined by the model, not in advance by humans) | Clustering |
| Gaussian mixture model | A generalization of k-means clustering that provides more flexibility in the size and shape of groups (clusters) | Clustering |
| Hierarchical clustering | Splits clusters along a hierarchical tree to form a classification system. Can be used to cluster loyalty-card customers | Clustering |
| Recommender system | Helps to define the relevant data for making a recommendation. | Clustering |
| PCA/t-SNE | Mostly used to decrease the dimensionality of the data. The algorithms reduce the number of features to 3 or 4 vectors with the highest variances. | Dimension Reduction |
How to Choose Machine Learning Algorithm
There are plenty of machine learning algorithms, and the choice of algorithm is driven by the objective rather than by fashion.
In the machine learning example below, the task is to predict the type of flower among three varieties. The predictions are based on the length and the width of the petal. The picture depicts the results of ten different algorithms. The picture on the top left is the dataset itself, with the data classified into three categories: red, light blue and dark blue. Some groupings are visible. For instance, in the second image, everything in the upper left belongs to the red category, the middle part holds a mixture of uncertainty and light blue, while the bottom corresponds to the dark category. The other images show how different algorithms try to classify the same data.
Once a candidate is chosen, its quality is judged on data it has never seen, usually with a confusion matrix and the accuracy, precision and recall figures derived from it.
Challenges and Limitations of Machine Learning
The primary challenge of machine learning is the lack of data, or the lack of diversity within the dataset. A machine cannot learn if there is no data available. A dataset that lacks diversity also gives the machine a hard time, because a machine needs heterogeneity to learn a meaningful insight. It is rare that an algorithm can extract information when there are no or few variations. A common rule of thumb is to have at least 20 observations per group to help the machine learn; below that, evaluation and prediction both suffer.
Data volume is not the only limit. Models trained on biased historical records reproduce that bias, complex models are hard to explain to a regulator or a customer, and any model degrades as the world it was trained on changes.
Application of Machine Learning
The techniques above already run in production across most industries. The examples below move from general assistance to specific sectors.
Augmentation: Machine learning assists humans with their day-to-day tasks, personally or commercially, without having complete control of the output. Such machine learning is used in different ways, such as virtual assistants, data analysis and software solutions. The primary purpose is to reduce errors caused by human bias.
Automation: Machine learning works entirely autonomously in any field without the need for human intervention. For example, robots perform the essential process steps in manufacturing plants.
Finance industry: Machine learning is growing in popularity in the finance industry. Banks mainly use ML to find patterns inside the data, but also to prevent fraud.
Government organizations: Governments make use of ML to manage public safety and utilities. Take the example of China and its large-scale face recognition programme, where artificial intelligence applications are used to identify jaywalkers.
Healthcare industry: Healthcare was one of the first industries to use machine learning, starting with image detection.
Marketing: Broad use of AI is made in marketing thanks to abundant access to data. Before the age of mass data, researchers developed advanced mathematical tools such as Bayesian analysis to estimate the value of a customer. With the boom in data, marketing departments rely on AI to optimize customer relationships and marketing campaigns.
Example of Machine Learning in the Supply Chain
Machine learning gives strong results for visual pattern recognition, opening up many potential applications in physical inspection and maintenance across the entire supply chain network.
Unsupervised learning can quickly search for comparable patterns in a diverse dataset. In turn, the machine can perform quality inspection throughout the logistics hub and flag shipments with damage and wear.
For instance, IBM’s Watson platform can determine shipping container damage. Watson combines visual and systems-based data to track, report and make recommendations in real time.
In the past, stock managers relied extensively on manual methods to evaluate and forecast inventory. When big data and machine learning are combined, better forecasting techniques become possible, with reported improvements of 20 to 30 percent over traditional forecasting tools. In terms of sales, that translates into an increase of 2 to 3 percent thanks to the potential reduction in inventory costs.
Example of Machine Learning in the Google Car
Everybody knows the Google car. The car is covered in lasers on the roof, which tell it where it is in relation to the surrounding area. It has radar at the front, which informs the car of the speed and motion of all the cars around it. It uses all of that data to figure out not only how to drive the car but also to predict what the drivers around it are going to do. What is impressive is that the car processes almost a gigabyte of data a second.
Why is Machine Learning Important?
Machine learning is the best tool so far to analyze, understand and identify a pattern in the data. One of the main ideas behind machine learning is that a computer can be trained to automate tasks that would be exhausting or impossible for a human being. The clear break from traditional analysis is that machine learning can make decisions with minimal human intervention.
Take the following example: a retail agent can estimate the price of a house based on personal experience and knowledge of the market.
A machine can be trained to translate the knowledge of that expert into features. The features are all the characteristics of a house, the neighborhood, the economic environment and so on that make the price differ. For the expert, it probably took years to master the art of estimating the price of a house, and the expertise improves after each sale.
For the machine, it takes millions of data points (i.e., examples) to master this art. At the very beginning of its learning, the machine makes mistakes, much like a junior salesperson. Once the machine has seen enough examples, it has enough knowledge to make its estimation, and to do so with high accuracy. The machine is also able to correct its mistakes as new sales arrive.
Most large companies have understood the value of machine learning and of holding data. The McKinsey Global Institute estimated the annual value of all analytics techniques at $9.5 trillion to $15.4 trillion, and attributed roughly 40 percent of that — some $3.5 trillion to $5.8 trillion a year — to advanced AI techniques based on deep neural networks, as set out in its Notes from the AI Frontier research.
Where rules are known but imprecise rather than absent, a rule-based approach such as fuzzy logic can be a better fit than a learned model, so the two techniques are often compared before a project starts.




