What is Machine Learning?
The word ‘Machine’ in Machine Learning means computer, as you would expect. So how does a machine learn?
Given data, we can do all kind of magic with statistics: so can computer algorithms.
These algorithms can solve problems including prediction, classification and clustering. A machine learning algorithm will learn from new data.
Related course: Complete Machine Learning Course with Python
Types of learning
There are two types of learning: supervised learning and unsupervised learning.. Say what?
Supervised learning
Let’s suppose we have consumer data. I tell the computer: these customers have a high income, those customers have median income. The training phase.
Then we can ask this computer:
You: Does this customer have a high or median income?
Computer: Based on the training data, I predict a high income.
Python code
So does training data have to be large and complex? No, this is also works for small data sets.
Take for instance, this set:
x = [[2, 0], [1, 1], [2, 3]] |
So what does this mean:
- Look at y, there are two possible outputs. Either it’s class 0 or class 1.
- Then x are the measurements.
The trainining data (x,y) is then used to feed the algorithm, with the feed() method.
nyour_amazing_algorithm.fit(x, y)
Then if you have new measurements, you can predict the output (class 0 or class 1).
print (clf.predict([[2,0]])) |
Unsupervised learning
With unsupervised learning algorithms, you have no idea. You give the data to the computer and expect answers. Surprisingly, these work rather well.
If you have data points x, where each value of x is a two dimensional point.
Want to make predictions?
Load an algorithm:
kmeans = KMeans(n_clusters=2, random_state=0).fit(X) |
Predict:
kmeans.predict([[12, 3]]) |
Yes, it can be that easy.