Naem Azam
Naem Azam
Web Developer Software Developer Linux Admin UX & UI Design
Naem Azam

Blog

Machine Learning: Introduction

Machine Learning: Introduction

Machine Learning is probably one of the most interesting and hyped branches of computer science. But, What is ML? What does it do? And what makes Machine Learning so popular? Don’t worry we’ve got you covered. But before you proceed it is advised that you know python, if don’t know Python you can learn it from our Python Tutorial .

What is ML?

The thing that seperates Humans form machines is the fact that humans learn from their expiriences. But is it possible to make a machine learn?

And The answer is Yes!

Machine Learning is a subdomain of Artificial Intelligence in which algorithms improve on their own through experience. And this expirience is nothing but Data. Data is the lifeline of ML, quality of data can significantly affect the performance of your model. That’s why a good to know how to manipulate data.

How ML works?

Let’s understand this with an example. Imagine there are 5 houses with following specification:-

Area of the House(in square feet) Price of The House(in ₹)
1000 120000
500 60000
800 80000
900 100000
1500 180000

This data is fictional

Let’s assume for now that Price of a house is solely determined by the Area of the House. So, what would the price of the house of area 120000 square feet? Based on the data above, we can say that the answer lies somewhere in between ₹120000 to ₹180000. After thinking for a while we might be able to pinpoint the price too. But how will you make a machine make a guess?

To understand that let’s plot the data on a graph:-

Scatter Plot of House Data

Now once the machine have this data plotted on the graph. The ML model will improve itself and find the best fit for the line in the curve such that each point on the line, i.e. (x,y) where x is the area of the house and y is the predicted price of that house, this line will be fitted in the plot in such a way that the predicted values are nearer to the actual values. The Line will look something like this:-

Line on the plot

Now for the above line the value corresponding to x(Area) = 1200 is y(Price) = 140451.

The above method is something called Linear Regression. Which we’ll learn about more in this series. But how did our model learn that this particular line is the best fit?

How did it find the line?

Now before learning how did it find the line let’s understand what a line is? A Line is exactly what it says, A LINE. But Mathematically, Line is an equation of form:-

y = mx + c

Now, what the model will do is that it’ll start with random value of m and c and since these are random values it could be anything, let’s say m = 300 and c = 9000. Next let’s plot this line on our scatter plot:-

Hmm, this line doesn’t look like it’s predicting the values accurately. So what now? Now the line will take our data as input and update the value of m and c such that the line is the best fit to the scatter plot. The in-depth math on how to get the best values for m and c will be explained in the linear regression section but just to feed your curiosity we find the best m and c (or sometimes referred as a and b) by a method called Ordinary Least Squares. We’ll discuss this further in the series too.

What makes it special?

Now you might be wondering whats so speacial about ML, all it is is just mathematics at play. And you are mostly right, ML is Math in its core. But even though the above algorithm is the most basic one, the fact that the same algorithm can improve itself to fit itself for the given data is what makes ML special. You just feed the data to the algorithm and the algorithm will improve on its own. And that is why ML is special, you don’t need you redesign your algorithm according to data, you just need the data and leave the improvement to ML.