Introduction To Machine Learning With Example | Tutorials For Beginner
loader image
Quick Tips

An Introduction to Machine Learning With Sample Program

Hi Geeks, As we all are very curious over Machine Learning,  Just like the same I started involving myself in exploring more about Machine Learning just like you. Thankfully I had found all the basics introductions of Machine Learning and all about its advancements, but to be precise, i didn’t had an idea about where to start or how.

So the idea behind this article is to help you guys to kick start machine learning with the sample program.

Machine Learning

Machine learning (ML) is a type of artificial intelligence (AI) that allows software applications to become more accurate in predicting outcomes without being explicitly programmed. The basic premise of Machine Learning is to build algorithms that can receive input data and use statistical analysis to predict.

Categories of Machine Learning

There are 3 types in Machine Learning as listed below,

(i) Supervised Learning
(ii) Unsupervised Learning
(iii) Reinforcement learning

Supervised Learning

Supervised learning is the process of enabling the model to predict the future output values based on the previous examples. And the previous datasets will have the label. For example, The data set will have the inputs based on the outputs, Therefore, Supervised learning will predict the data based on the given examples.
Ex: Linear regression, logistic regression, random forest, decision tree, etc.

Unsupervised learning

In unsupervised learning the model to predict the future output values based on datasets which don’t have labels. Additionally, This model will group or cluster the datasets to detect the hidden patterns.

Ex: Apriori algorithm, K-means.

Reinforcement learning

Reinforcement learning works like a computational approach which will work based on the goal based learning and decision-making model. Which allows software agents and machines to automatically determine the ideal behavior within a specific context, to maximize its performance. Here the machine will have the direct interaction with the live environment.

Reinforcement learning will targets the explicit goals but Instead of that, reinforcement learning is forced to learn optimal goal by giving trial and error

Sample Program Of Supervised learning Using Python

As we mentioned, Here we start with the sample program of Supervised learning using python.

Before that, we need to install Python, Sklearn in our system.

Creating Dataset:

Create a file like



1. First we are import the randint

2. Then setting random int limit as 1000

3. We set the count of the data set limit as 100

4. we create two lists named as TRAIN_INPUT and TRAIN_OUTPUT

5. Finally, We are creating the data set with the below code


6. Appending the data set into our TRAIN_INPUT and TRAIN_OUTPUT


Step 1:

Importing LinearRegression from sklearn.linear_model


Step 2:

Below codes involves to train the model


Step 3:

Finally, we can predict a value by the trained model


Step 4:

Setting an outcome variable to get an output.

Step 5:

Finally, we can get the coefficients of the inputs as you can see in below code and final output.

Source Code




To start with the basics, I just covered with supervised learning and eventually will explore more about Machine Learning in upcoming blogs. In case if you have any queries in this blog leave your feedback in the comment section or if you found it helpful share it with your other friends too. Let’s grow each other.

The following two tabs change content below.

Gowtham S

An energetic Android developer aspiring to become a Full stack app developer With 1 year of experience in developing apps. And, This young brainy bomb will just blast us with numerous hacks. You may not believe that this cool guy love for beach is too high! regardless of where he is, he rush to get alongside the Seashore to ensure his mornings are raised with beach breeze.

Leave a Reply

Your email address will not be published. Required fields are marked *

Join our 30,000+ subscribers, never miss out anything on our latest blogs, tips, tutorials, updates & more.