...

/

LR Implementation Steps: 1 to 3

LR Implementation Steps: 1 to 3

This lesson will start introducing the implementation steps (1-3) of the linear regression.

1) Import libraries

Let’s begin by importing the following Python libraries:

Press + to interact
#1. Import libraries
import pandas as pd
import seaborn as sns
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn import metrics

Note: Codes of further steps won’t include codes of previous steps. They’re already appended at the backend for you.

2) Import dataset

Using the Pandas pd.read_csv command, load the CSV dataset into a data frame and assign the data frame as a variable called df using the equals operator.

Melbourne housing dataset variables

Feature

Data Type

Continuous/Discrete

Suburb

String

Discrete

Address

String

Discrete

Rooms

Integer

Continuous

Type

String

Discrete

Price

Integer

Continuous

Method

String

Discrete

SellerG (seller's name)

String

Discrete

Date

TimeDate

Discrete

Distance

Floating-point

Continuous

Postcode

Integer

Discrete

Bedroom2

Integer

Continuous

Bathroom

Integer

Continuous

Car

Integer

Continuous

Landsize

Integer

Continuous

BuildingArea

Integer

Continuous

YearBuilt

TimeDate

Discrete

CouncilArea

String

Discrete

Latitude

String

Discrete

Longitude

String

Discrete

Regionname

String

Discrete

Propertycount (is that suburb)

Integer

Continuous

Please note that the Latitude and Longitude variables are misspelled in this dataset, but ...

Access this course and 1400+ top-rated courses and projects.