Kaggle competition: Regression Evaluative Lab
training_set = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-4/train.csv')
 training_set.shape<load_from_csv>
data = pd.read_csv('.. /input/train.csv')
 test = pd.read_csv('.. /input/test.csv')
 data.head()
test_set = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-4/test.csv')
 test_set.shape<filter>
X = data.drop(['AveragePrice'], axis=1)
 y = data['AveragePrice']
X_train, X_val, y_train, y_val = train_test_split(X, y, test_size=0.33, random_state=42)
N_train=len(training_set[training_set['Country_Region']==my_country])
 N_train<filter>
model = XGBRegressor(n_jobs=4, learning_rate=0.05, max_depth=8, min_child_weight=0.5, n_estimators=1300)
 model.fit(X,
y,
verbose=True)
 test_predict_optimal = model.predict(test)
 new_df = pd.DataFrame({"id": test['id'] , "AveragePrice":test_predict_optimal})
 new_df.to_csv("XGB_manual_custom_5.csv", index=False )
N_test=len(test_set[test_set['Country_Region']==my_country])
 N_test<prepare_output>
predictions = model.predict(X_val)
 scores = cross_val_score(model, X, y, scoring='neg_mean_absolute_error', cv=5)
 print(scores)
 print('Mean Absolute Error: %2f' %(-1 * scores.mean()))
df_test = test_set.copy()
df_test['DsType']='test'
df_test['ConfirmedCases']=0
df_test['Fatalities']=0
df_test.info()<concatenate>
mae = mean_absolute_error(predictions, y_val)
 print("Mean Absolute Error : " + str(mae))
error_percent = mae/data['AveragePrice'].mean() *100
print(str(error_percent)+ ' %')