Linear Regression in machine learning- algorithm-code-project 01

Spread the love

Linear Regression machine learning: part01

Welcome everyone, Today we will going to start New part of our course(Machine Learning). In this section we see first Regression algorithms. 
This Regression Algorithm divided into three parts:
PART_01 Check out data and see all plots
PART_02 Training and Testing a Linear Regression Model
PART_03  Exercise and Solution
At the end of every post link are provided of the every part. 

What is Regression?

Linear Regression in python search for relationship can observe several employees of the company and try to understand how their salaries depends on the feature.This is a regression problems  where data related to each employee represent one observation. The presumption is that the experience, education, roles, and city are the independent feature, while the salary depend on them.

what is Linear Regression Machine Learning?Linear regressions is probably one of the most important and widely used regressions techniques. It is among the simplest regression method. One of its main advantages is the ease of interpreting result.


Your neighbor is a real estate agents and want some help predicting housing prices for regions in the USA. It would be great if you could somehow create a model for her that allow her to put in a few features of a house and returns back an estimate of what the houses would sell for.
He has asked you if you could help her out with your new data science skills. You say yes, and decide that Linear Regressions might be a good path to solve this problem!
Your neighbor then give you some information about a bunch of houses in region of the United States,it is all in the data set: USA_Housing.csv.
The data contains the following column:
  1. ‘Avg. Area Incomes’
  2. ‘Avg. Area House Ages’
  3. ‘Avg. Area Number of Room’
  4. ‘Avg. Area Number of Bedroom’
  5. ‘Area Populations’
  6. ‘Prices’ 
  7. ‘Addresses’

Check out the data

We have been able to get some data from your neighbor for housing prices as a csv set, let’s get our environment ready with the libraries we will need and then import the data.

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline

USAhousing =pd.read_csv('USA_Housing.csv')


Avg. Area IncomesAvg. Area House AgesAvg. Area Number of RoomAvg. Area Number of BedroomArea PopulationsPricesAddresses



Avg. Area IncomesAvg. Area House AgesAvg. Area Number of RoomAvg. Area Number of BedroomArea PopulationsPrices

Let's create some simple plot to check out the data.


For the Training and Testing a Linear Regression Model See Part_02 of Linear Regression machine learning post.
(Note: If you like the post then please comment and share)

sachin Pagar

I am Mr. Sachin pagar Embedded software engineer, the founder of Sach Educational Support(Pythonslearning), a Passionate Educational Blogger and Author, who love to share the informative content on educational resources.

Leave a Reply