Introduction to Machine Learning — Linear Regression

This post is divided into following sections:
1. What is Machine Learning
2. Applications of Machine Learning
3. Simple example and related concepts
4. Demo

What is Machine Learning:
Machine learning is a mixture of mathematics and computer science, where learning algorithms mimics human learning process. There are mainly 3 kinds of machine learning.
1. Supervised Learning — Regression, Classification
2. Unsupervised Learning — Clustering
3. Reinforcement Learning — Game Players

Simple Example and Related Concepts:
Linear Regression: Fit a linear model for given data.
House Price Prediction:
lets say house price depends on the following factors Sqft, #bedrooms, #bathrooms, lawn area, parking space, geographical location etc..
we need to build a model that predicts a house price by taking these factors into consideration. It is supervised learning problem, so we need training data, we train our algorithm to learn that training set and using that knowledge our algorithm predicts price for new inputs. By training we mean, we fit a model that roughly represents trend given training set follows, as below..

source: https://statistics.laerd.com/spss-tutorials/linear-regression-using-spss-statistics.php

lets stick to simplest possible relation, linear..

our goal: fit a linear model that represents our data(training)
how to achieve our goal: 
step 1. lets start with a random linear model.
step 2: measure how erroneous our linear model is (distance is a good idea).
step 3: minimize that error using some optimization techniques.

step 3 implementation:
lets draw a graph that represents relation between our model parameters and the error value.for simple cases, we get the following kind of graph

as said earlier, we start with a random line and we calculate the error value, we need to minimize the error, that means we need to change the model parameters that incurs less error, gradient descent algorithm helps us..
for more details about gradient descent, visit my previous post.. https://medium.com/@bgautam0707/all-about-gradient-descent-a8b915ac99fc

Finally we fit a good model that represents our training data, when we encounter new data point(s), we predict the outcome by trained model.