YOUR FIRST MACHINE LEARNING PROJECT

Anjan Parajuli
Analytics Vidhya
Published in
5 min readDec 17, 2020

--

Hmm…it’s been a while since I have not written any articles but guess what????

I am back with the bang to help you do your first machine learning project….

Don’t get intimidated by the name of MACHINE LEARNING…It sounds formidable not due to itself but due to the hype around the world that perceives this field as a career to be pursued by only the chosen ones…so called masterminds and inborn talents …🙄🙄

Would you like to know what I think..?

No ,not at all….It is a common field that can be pursued by anyone out there..
Man….you are just saying this field a minor field but how???
Well well well…that is why I have written this article…..for you all my friends to get you familiar with machine learning and help you do a small project in machine learning…bammm😍

NOTE: It will be short but it will give you knowledge about what are the few most common terminologies used in this field…

And yeah we are using python….but wait….wait…. don’t run I am taking you through this path….It will be so easier that you will learn needed python with this article……double baammm..😂

The only thing you need to do is go with me….

PROJECT 1:FINDING SQUARE OF NUMBER USING ML

So folks , the thing is that for a machine learning project…you need an environment for which I have recommended you to use google colab for now in first step.

The other requirements are training data,test data and algorithm. Don’t worry ,we are using these things so comfortably that you will understand them as you go along. If you would like to understand it better , you could see my another article or you might just go with my steps for now..

Link for my article:https://medium.com/@anjanparajuli2001/easiest-way-to-understand-machine-learning-c95803b751d4?sk=e3bcfc0d33fc39a322b3affd971c35cd

STEP 1:OPEN GOOGLE COLAB

Click the above link and open a new notebook. You will sort it out in a second and know how to open a new notebook like this below after clicking above link:

STEP 2: IMPORTING REQUIRED TOOLS

You just have to write on your notebook what I have written below.

Numpy is just a python library for numerical computing but don’t worry ,we are just doing a simple math. We will be using it to create our data.

STEP 2: CREATING OUR DATA

My friends, machine learning is like a baby, learning something through mistakes using different available materials. Here in machine learning, baby is the algorithm and data are the learning materials. So, here we are creating our data using numpy.

And the data that the algorithm needs to learn from is called training data.

And features are the characters of data and labels is the correct result that we provide to algorithm. Since we are finding square of numbers, we are giving algorithm the numbers two times(features) and the correct result i.e multiplication of the numbers(labels). The algorithm has to find the formula in its own.

Just type what I have written below.

Here, we are just creating array of numbers. You don’t need to understand more here.

Just know that

Number =features

Square=labels

STEP 4: IMPORTING THE ALGORITHM

Here ,we are giving birth to a baby who is going to be smart after us learning with our learning materials .Be proud you are having a smart baby😂😂.

algorithm=baby

training data=learning materials

Guess our baby’s name ,its

GaussianNB read as “gaussian naive bayes”

and this is how we import it:

STEP 5: TRAINING THE ALGORITHM

You know what?? Congrats folks, you have created your first machine learning models, though small but it is the beginning of your machine learning career.😃

Here , the first step, model=GaussianNB is like waking our baby up from sleep.In technical term, it is called instantiating the algorithm.

The second step ,model.fit(Number,Square) tells our algorithm to learn from given training data i.e features and correct result.

Algorithm will find a pattern from the data after training. And to check how correctly has it found the pattern, we need to predict the model on test data.

Test data is like the exam papers for the algorithm. It will predict on the test data and we check whether it has predicted correctly or not like this below:

STEP 6: PREDICTION

Hurray!!! The model predicted the right number. The square of 3 is 9.

Wait wait ..wait.. it is predicting correctly for the seen number but what if we check for numbers other than the numbers that we have not previously fed to the algorithm.

OOPS!!! It predicted wrong because the algorithm trained using very less data.We provided it with about 7 data but in real world,we are training it with millions of data or at least thousands of data.So, more the data ,better will be the model.

And yeah if you got confused with test data.Test data is data that we use for checking whether our model is performing well or not.So, for that we should use data that has not been previously given to the algorithm for training.

Hence, machine learning is all about creating good data, training on the right algorithm and getting best prediction and the feedback loop of above steps.

So, buddies I really hope you get a bit of knowledge about machine learning from this article. If any questions , you could ask in the comment sections.

Thank you ,have a safe and healthy life. See you in the next article.

--

--