text_plain_output_3.png text_plain_output_2.png text_plain_output_1.png
from sklearn.linear_model import LinearRegression

from sklearn.metrics import mean_squared_error

from sklearn.model_selection import train_test_split

import matplotlib.pyplot as plt

import os

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
import os
bkshare_df = pd.read_csv('../input/bike_share.csv')
bkshare_df1 = bkshare_df.copy()

def remove_duplicates(bkshare_df1):
    bkshare_df1.drop_duplicates(inplace=True)
def descibe_df(bkshare_df1):
    pass
def bkshare_corr(bkshare_df1):
    pass
remove_duplicates(bkshare_df1)
descibe_df(bkshare_df1)
bkshare_corr(bkshare_df1)

plt.figure(figsize=(10,5))
ax = sns.heatmap(bkshare_df1.corr(), annot=True)
plt.show(ax)

X = bkshare_df1.drop(['count', 'casual', 'registered'], axis=1)
Y = bkshare_df1['count']
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.3, random_state=12)

model = LinearRegression()
model.fit(X_train, Y_train)

Y_train_predict = model.predict(X_train)
display(Y_train_predict.shape)
Y_test_predict = model.predict(X_test)
display(Y_test_predict.shape)
print('Train MSE:', mean_squared_error(Y_train, Y_train_predict))
print('Test MSE:', mean_squared_error(Y_test, Y_test_predict))