Created
November 23, 2020 16:41
-
-
Save nithyadurai87/574937ad8928278057adf43405f213de 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 pandas as pd | |
from sklearn.linear_model import LinearRegression | |
from sklearn.model_selection import train_test_split,cross_val_score | |
#from sklearn.externals import joblib | |
import joblib | |
from sklearn.metrics import mean_squared_error | |
import matplotlib.pyplot as plt | |
from math import sqrt | |
import os | |
df = pd.read_csv('./data.csv') | |
i = list(df.columns.values) | |
i.pop(i.index('SalePrice')) | |
df0 = df[i+['SalePrice']] | |
df = df0.select_dtypes(include=['integer','float']) | |
X = df[list(df.columns)[:-1]] | |
y = df['SalePrice'] | |
X_train, X_test, y_train, y_test = train_test_split(X, y) | |
regressor = LinearRegression() | |
regressor.fit(X_train, y_train) | |
joblib.dump(regressor, './model.pkl') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment