Machine Learning For Beginners

Manoj kumar
Build for Billions
Published in
4 min readJun 29, 2019

This story is to make the beginners understand the basic ideology of ML

The term machine learning was introduced in the ’90s. But lack of data, It can’t be successful at that time. After the boom of the internet, Nowadays Machine Learning is successful.

In the future, Ai will rule this world. In that Machine Learning (ML), will be an integral part of it. So, I wish to have all my developers and students to get started on ML first. I had planned to make it as the story series. You will find the different topics will be explained in ML.

Machine Learning in Ai

Python + Machine Learning = Future

There are two learning types in ML,

  1. Supervised Learning
  2. Unsupervised Learning.

Supervised Learning:

supervised learning will really helpful for the developers when they know the exact input and outputs.

I mean You don’t want to code the logic, simply use the known inputs and outputs and train an ML Model. We will see it as a demo code below.

There are two things in supervised learning,

  1. Classification.
  2. Regression.

Regression:

Regression is a way, we can use in several use cases like heat converter, Retail pricing, etc. We will see the heat converter as a demo now.

Let we consider a problem, that we need to convert Celsius to Fahrenheit.

X is Celsius and Y is Fahrenheit, these are the random data we are going to train our ML Model.

Create a python 3 notebook, in colab.com. It is an integrated development area, where you can have access to free GPU & TPU. where you can train a highly computational model. All the major python libraries had been pre-installed in a notebook like tensorflow, numpy, scikit learn, etc.

Import the following libraries,

Then declare and assign values to Celsius and Fahrenheit List, X => Celcius, Y => Fahrenheit.

Now the meaty part comes,

you have to create a simple neural network with the use keras library that we imported before.

In the above picture, You see words like sequential, Dense, units, input_shape.

  1. sequential — it is like a container where our network layer has been getting bounded
  2. Dense — It is the actual neural net layer where our data will get trained here.
  3. Units — It actually defines the number of input should a model take to train for one iteration.
  4. Input_shape —Shape of input like if it is a number then it will be 1, if it is a picture the iinput_shape will be ( HEIGHT * WIDTH * 3), where 3 is for the color channel RGB.

Now we need to compile our model,

In this compile, we need to specify the optimizer, loss function and metrics. This will be discussed in future stories, so stay tuned for the next stories.

Let’s start fitting our data into our compiled model,

Here we are fitting our model with Celsius(x) and Fahrenheit(y).

Epochs are actually specifying the number of iterations that our model should do with these data.

After 2000 iterations completed we need to start testing the model.

use predict function on the model,

That’s it you will get the answer 672.802 for the input of 356, Let we check,

That’s all for this story. See you on next story.

--

--