Created
January 14, 2021 17:50
-
-
Save saimadhu-polamuri/dace984e52fbb800efdd6511a1896c5c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## import the required libraries | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from statistics import mean | |
from sklearn.linear_model import LinearRegression, Ridge, Lasso | |
from sklearn.model_selection import train_test_split, cross_val_score | |
## load the dataset | |
df = pd.read_csv("kc_house_data.csv") | |
## dropping unnecessary columns | |
df = df.drop(['id', 'date', 'zipcode'], axis=1) | |
## separating the target variable | |
X = df.drop('price', axis=1) | |
y = df['price'] | |
## splitting the data into train and test (70-30 ratio) | |
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.30) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment