import pandas as pd
import numpy as np
from fbprophet import Prophet
df_train = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/covid19_0324/ca_train.csv')
df_test = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/covid19_0324/ca_test.csv')
df_sub = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/covid19_0324/ca_submission.csv')
df_train = df_train[df_train['ConfirmedCases'] > 0]
import seaborn as sns
sns.lineplot(df_train['Date'], df_train['ConfirmedCases'])
sns.regplot(df_train['Id'], np.log(df_train['ConfirmedCases']))
ConfirmedCases
¶from sklearn.linear_model import LinearRegression
model_lr = LinearRegression()
Id
; y = ConfirmedCases
¶X = np.array(df_train['Id']).reshape(-1,1)
y = df_train['ConfirmedCases']
model_lr.fit(X,y)
print('R2', model_lr.score(X,y))
Id
; y = log(ConfirmedCases
)¶X = np.array(df_train['Id']).reshape(-1,1)
y = np.log(df_train['ConfirmedCases'])
model_lr.fit(X,y)
print('R2', model_lr.score(X,y))
Fatalities
¶X = np.array(df_train['Id']).reshape(-1,1)
y = df_train['Fatalities']
model_lr.fit(X,y)
print('R2', model_lr.score(X,y))
X = np.array(df_train['Id']).reshape(-1,1)
y = np.log(df_train['Fatalities'])
model_lr.fit(X,y)
print('R2', model_lr.score(X,y))
X = np.array(df_train['ConfirmedCases']).reshape(-1,1)
y = df_train['Fatalities']
model_lr.fit(X,y)
print('R2', model_lr.score(X,y))
X = np.array(np.log(df_train['ConfirmedCases'])).reshape(-1,1)
y = np.log(df_train['Fatalities'])
model_lr.fit(X,y)
print('R2', model_lr.score(X,y))
cc_model = LinearRegression() # cc = Confirmed Count
X = np.array(df_train['Id']).reshape(-1,1)
y = np.log(df_train['ConfirmedCases'])
cc_model.fit(X,y)
print('R2', cc_model.score(X,y))
fc_model = LinearRegression() # fc = Fatality Count
X = np.array(df_train['ConfirmedCases']).reshape(-1,1)
y = df_train['Fatalities']
fc_model.fit(X,y)
print('R2', fc_model.score(X,y))
df_test.head()