Kaggle competition: COVID19 Global Forecasting (Week 4)
X_tra, X_val, y_tra, y_val = train_test_split(x_train, y, test_size = 0.1, random_state=42 )<train_model>
sub1=pd.read_csv('/kaggle/input/rscript-week4/submission.csv')
 sub4=pd.read_csv('/kaggle/input/trmfdata/submission.csv')
 sub4.sort_values("ForecastId", inplace=True)
 sub1.sort_values("ForecastId", inplace=True)
 train = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-4/train.csv')
 dacheckv='2020-04-01'
train['Province_State'].fillna('', inplace=True)
 train['Date'] = pd.to_datetime(train['Date'])
 train['day'] = train.Date.dt.dayofyear
train['geo'] = ['_'.join(x)for x in zip(train['Country_Region'], train['Province_State'])]
train=train[train.Date>dacheckv]
test = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-4/test.csv')
 test['Province_State'].fillna('', inplace=True)
 test['Date'] = pd.to_datetime(test['Date'])
 test['day'] = test.Date.dt.dayofyear
test['geo'] = ['_'.join(x)for x in zip(test['Country_Region'], test['Province_State'])]
test1=test.merge(train,on=['Country_Region','Province_State','Date'],how='inner')
 print(RMSLE(sub1[sub1.ForecastId.isin(test1.ForecastId.values)]['ConfirmedCases'].values,test1['ConfirmedCases'].values))
print(RMSLE(sub1[sub1.ForecastId.isin(test1.ForecastId.values)]['Fatalities'].values,test1['Fatalities'].values))
hist_glove = model_glove.fit(X_tra, y_tra, batch_size=batch_size, epochs=epochs, validation_data=(X_val, y_val),
verbose=True)
 pred_glove_y = model_glove.predict(x_test, batch_size=1024)
 pred_glove_y =(pred_glove_y[:,0] > 0.33 ).astype(np.int )<save_to_csv>
print(RMSLE(sub4[sub4.ForecastId.isin(test1.ForecastId.values)]['ConfirmedCases'].values,test1['ConfirmedCases'].values))
print(RMSLE(sub4[sub4.ForecastId.isin(test1.ForecastId.values)]['Fatalities'].values,test1['Fatalities'].values))
submit_df = pd.DataFrame({"qid": test_df["qid"], "prediction": pred_glove_y})
 submit_df.to_csv("submission.csv", index=False )<define_variables>
sub1=sub1.reset_index(drop=True)
 sub4=sub4.reset_index(drop=True)
 sub_df = sub1.copy()
TARGETS = ["ConfirmedCases", "Fatalities"]
for t in TARGETS:
sub_df[t] = sub1[t]*0.4 + sub4[t]*0.6
sub_df.to_csv("submission.csv", index=False)
 print(RMSLE(sub_df[sub_df.ForecastId.isin(test1.ForecastId.values)]['ConfirmedCases'].values,test1['ConfirmedCases'].values))
print(RMSLE(sub_df[sub_df.ForecastId.isin(test1.ForecastId.values)]['Fatalities'].values,test1['Fatalities'].values))