# Understanding machine learning

Machine learning is the practice of using mathematical algorithms to recognize patterns in data and then use those patterns to make predictions.

## A simple example: Predicting sales

To better understand machine learning, let’s look at a simple example that predicts the sales of a product over the next quarter. We might know that sales of this product are affected by how much money is spent advertising the product. By looking at the data from previous quarters we know:

• How much money is spent (in thousands of dollars) advertising the product on television.

• What the sales were (in millions of dollars).

When we plot the data, it is obvious that the more money that is spent advertising our product on television, the more we sell.

To predict the sales revenue during the next business quarter, we can fit a function to the historical data:

Based on the amount of money we have budgeted to spend in television advertising during the next business quarter, we can evaluate the function at the value corresponding to this amount. Say that we are planning on spending \$225,000 in television advertising next quarter. Evaluating the function at 225 gives us 17.7, and we can forecast \$17.7 million in sales for the next quarter.

To further improve the accuracy of our prediction, we can try to find a function that better fits the historical data—as shown in the figure—and make predictions based on this function.

In this example, we have only looked at the amount of money spent on television advertising. We could also consider other factors that influence future sales. Instead of having sales as a function of television ad spend alone, we could, for example, have sales as a function of the three variables television ad spend, radio ad spend, and newspaper ad spend. We can use as many variables as we want, but the general idea is the same.

## Machine learning concepts

From a data perspective, the machine learning problem is reduced to compiling a table with historical data. We have one column in the table representing what we want to predict, which in our previous example was sales. In the language of machine learning, this column is called the target. The other columns are called features and are used to predict the value of the target column. The features are variables that can potentially contribute to the target outcome. The fundamental idea behind machine learning is:

Given a dataset, we find a function that fits that data so that we can predict what the value for the target column will be given the values for the feature columns.

Several sophisticated machine learning algorithms have been developed to solve different kinds of machine learning problems. When we feed data to a machine learning algorithm and let it learn patterns, we say that we are training a machine learning algorithm.

Machine learning problems are divided into regression problems or classification problems, depending on if the target we want to predict is a numerical or categorical value. See examples in Classification problems and Regression problems.

## Automated machine learning

With automated machine learning, the best fitting functions are found automatically during the training on your historical data. You can easily upload a dataset, select a target, and then start the training at the push of a button.

However, you will only get a good predictive output if you have good input. A machine learning experiment needs a well-defined machine learning question and a dataset designed to answer that question. To get started with your first experiment, follow these steps:

1. Define a machine learning question

Turn your business use case into a specific question using a structured framework.

Defining machine learning questions

Collect good-quality data that is relevant for your use case.

3. Create an automated machine learning experiment

When the preparations are done, you can start experimenting.

Working with experiments

Related learning: