Machine Learning A to Z: Part 1
Tags: machinelearning, stanford, andrewng
Published: 2022-07-06 11:38:30


Some machine learning Algorithms are 
1. Supervised ML Algorithm
2. Unsupervised ML Algorithm
3. Recommender systems
4. Reinforcement Learning

**Supervised ML Algorithm**
This algo basically learns from input to output labels

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n6cb1dew3077hqzc2bg5.png)
 
Just see how these different Algorithms take inputs and gives which outputs


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p2og79z4g4cu0glq4act.png)

All of these models have training models and you train them with data.

Lets learn from an example

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62rlwa18b9tosu28kyd7.png)
Depending on the size of the house, you want to know the price of a house.
Assume that you want to know the price for a house which has 150 square feet

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fxhh0r5qjqqxzhtwg4nh.png)
Now , you may draw a straight line and get some value

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t2u79pxktiql2izzofho.png)

But you can do some complex works too , to get most correct data.
If you create a curve, you can see the price changes and this time it shows even more from the past time


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vayjb5rlf88j5bkqlonj.png)
Ultimately, you will get a value but mainly this is how in supervise model, machine learns what should be the data. We will know more correctly later, which process you should pick . But for this type of problem, we will use Regression .

We will know about this terms in the later part of the blog

Now, lets learn another way called Classification


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2cx1656gzrzuvlg1thdq.png)

Mainly we will try to predict breast tumors based on sizes. 

from a tumor, we can detect if it is malignant or not


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kc4yuf1fjk41x95c9hn5.png)

Now depending on the size of the tumor, it can be cancer (Represented by 1) or not (0)       

We can then create a graph with that
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e3u1ta8te50hotalbolh.png)

Depending on the output, we can draw points

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uhla94t1d1f3w3vvokcp.png)
As we have just 2 type of outputs, we can draw them on a line


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u6v0bdl8urwfe5qymvp5.png)

Now, we later found that there are 2 types of malignant . So, we pointed them out and classified them in this manner

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2eadnhwe3buisanv31ma.png)

So, classification algorithms predict categories and they not only predict numbers. It can be non numeric like malignant or benign for this Breast cancer prediction. 

Now if we also provide age with tumor size, the graph can be like this

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/23dms30h5fxaqjqgt2u8.png)

The doctor can easily predict the age & tumor size from the graph 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/688mtko1x9wja9sw5ur5.png)
 
Also, from this graph, we can make a curved line to differ malignant patients & not benign patients 



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vpr05hu2f608x7yabvs2.png)

In summary: Analyzes data and creates a label. For example, finds if a patient is diabetes patient or not.

 **Unsupervised ML Algorithm**
To find the patterns in data, we use unsupervised or Algorithm. For example, in supervised learning we tried to find if a person has cancer or not using tumor size etc . But in unsupervised learning, we will just find a pattern between them. We don't want to hear if a patient has cancer or not by providing the tumor size.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/65fypw2tgwuhwoi8uir8.png)
 
Basically it divides the data into clusters


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ghxxvdj3wnamqyfqnee.png)
For example, Google News uses clustering . Here you can see they have provided panda's news at headline and related other news in a cluster

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yikt1jvx7bt3eedhez57.png)
So, what basically did is found the articles having the same sort of words

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nb1mfpl62nahtctynvso.png)
Again, here is another example of DNA Clusterng

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iapeydpmsxnzsa6uskdp.png)
   
Each row stores gene information of each person and each column has genes which control certain behaviour

Now, we can cluster these genes into Type1, type 2, type 3.........
We won't say the behaviours of each type. Just cluster them.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qq16yhlmtjyzbvm5zskj.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7vwuora9m4wz9jpw4gen.png)

So, this is how we can cluster.

Moreover, we can have another example. We can have a clusters of customers.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/73ub638sp7fepa6bnc13.png)

Therefore , we can say

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/296p8au46m5xryy11mel.png)

In summary: creates different clusters by finding patterns