REGRESSION
Using Python
EXAMPLE DATASET
Area (Sq. Ft) Price (Rupees)
2500 550000
3000 590000
3200 650000
3650 700000
4100 750000
4500 820000
5000 900000
5500 970000
#We import the important libraries esp
the Sklearn library AKA scikit-learn to
perform Linear Regression (predictive
data analysis)
#The scatter
plot shows
whether the
data is set
for linear
regression
or not.
#fit – the Fitting the data mean training the
liner regression models using the available
data points
#Independent Variable is Area and the Dependent
variable is price
#The programme automatically calculated
the coefficient and the intercept to give us
the output
The linear regression
equation is Y=a+xb
#this is an excel file for which the prices are to
be predicted
#these are the predicted
values, but they are given in
an array form
#we assign a new object ‘p’
to the predicted value and
using ‘tp[‘prices’]’ function
declare a new column for
the dataset tp.
#when plotted in the
scatter plot data will
give us this output
where the predicted
values are arranged in a
particular order in a
linear format (in a
straight line)
#We use ‘to’
function to export
the data into a file
with the desired
format
THANKYOU