# A brief overview of machine learning

A few years ago, ‘big data‘ was the latest buzzword. Since about a year or two ago, we have moved on to ‘machine learning‘ (and blockchain). Machine learning (ML) is nothing new. It has been used for at least a few decades but only recently has it become accessible enough to be used in mainstream. Only recently have the ML models been made so easily available to everyone through open source libraries. And only recently has the computer processing power become so cheap that it can be easily afforded to deploy computation heavy ML models. Never before was there a better time to learn ML and start using it!

I am no ML expert. Maybe one day I can become one but for now, I am simply an ML enthusiast. One of the main issues with getting started with ML is that it sounds very sophisticated and by all means, it is! ML consists of a lot of complex models that have been optimized over several decades. Unless you have a strong background in mathematics, you will find it extremely difficult to understand the inner workings of these models. But don’t let that intimidate you! Thanks to all the recent development in open source software, most of the ML models are easily available to be used. All you need to do is understand how the models work and when to use them! Instead of getting bogged down by the mathematical details, try to focus on high level theory and how to easily apply ML models. Once you build your basic understanding, you can pick which model(s) you want to explore further.

### Simplify machine learning for me

‘Machine learning’ is a very vague term and encompasses a lot of sub-fields such as deep learning. I am going to try to simplify it for you.

In my 11th grade physics class, we used to have a lot of labs. Most of these labs consisted of collecting some data and then plotting it to understand relationship between two variables (independent and dependent variables). To identify the relationship, we would plot the data and many times, we would find a linear relationship between the independent and dependent variable. Using MS Excel, we would draw a line-of-best-fit which would try to encapsulate the relationship. The line would have an equation in the form: y = mx + b where y is the dependent variable, x is the independent variable, b is the y-intercept and m is the slope. Once you draw the line, you can find the slope (m) and y-intercept (b). And once you have the equation, you can then predict values of y for any value of x. This is the most basic model of ML and covers, in simple terms, what ML is about.

ML is the practice of identifying relationships among variables (features) in a dataset and predicting outcomes without being explicitly programmed. Now, what does that mean? In the previous example, we had an independent variable and a dependent variable. For example, let’s say our independent variable is calorie consumption and our dependent variable is weight. Consuming more calories will cause weight to increase. However, without knowing the detailed relationship, how can you predict what the weight will be when the calorie intake reaches a certain value. You can’t! You will need to collect some data about calorie consumption and weight and then from that data, derive the relationship! You will then use that relationship to predict values of weight for specific values of calorie consumption. This is called training your model and is a fundamental concept of machine learning. The machine MUST learn the relationships in your data to be able to accurately predict later. The machine will independently learn these relationships by simply analyzing the data you have provided. The resultant model is only as good as the data that it was trained on.

In the simplest terms, that’s what machine learning is! You feed your ML model some training data and it tries to identify different relationships. These models evolve as more and more data is fed to the model and ensures that the model doesn’t become outdated.

### Different ML problems

The example above covered the simplest ML model and it’s called Simple Linear Regression model. Obviously, not all relationships can be represented by a straight line. The world is more complex than that! There are different models for different types of relationships and problems.

Here are three types of problems:

1. Regression – what will be the value of a variable? For example, what should be the price of a specific home.
2. Classification – Given available groups, which group does this belong to? For example, will a patient survive or die.
3. Clustering – Without knowing any groups, which group does this belong to? For example, given this data about website visitors, see if you can find some similarities amongst different customers and group them somehow.

### Different ML models

For each of the problems mentioned above, there are multiple models depending on type of relationship and some other factors. Here is a short list of most popular models:

#### Regression

1. Simple Linear Regression model
2. Multiple Linear Regression model
3. Polynomial Regression model
4. Support Vector Regression model
5. Decision Tree Regression model
6. Random Forest Regression model

#### Classification

1. Logistic Regression model
2. K-Nearest Neighbors model
3. Support Vector Machine (SVM) model
4. Kernel SVM model
5. Naive Bayes model
6. Decision Tree Classification model
7. Random Forest Classification model

#### Clustering

1. K-Means Clustering model
2. Hierarchal Clustering model

Each of these models has its pros and cons and it takes practice to understand when and how to use the right model.

### Implementing these models

At this point, you are probably wondering how you will ever learn to implement so many models but don’t be overwhelmed by them. Many of them, such as Simple Linear Regression model, are very easy. However, most importantly, understand the amazing fact that you do not need how to code these models from scratch. You simply need to understand how to implement these models. Libraries such as scikit-learn have all of these models and many more already coded for you and all you need to know is when and how to use them.

In my future posts, I will show you how to implement these models and use them to analyze different datasets. Stay tuned and subscribe to my blog if you want to be notified of my future posts.

Note: I have not discussed concept of supervised vs unsupervised learning in this post to keep things simple. I will cover them in a future post.

Note: I, knowingly, avoided discussing deep learning (artificial neural networks and convolutional neural networks) which is a subset of machine learning and is slightly more complicated then rest of the models I mentioned above. If you are beginner, I recommend focusing on these basic models first before exploring deep learning. Also, while deep learning is very powerful, it can be an over-kill for many daily applications.