Kaggle competition: YKC-cup-1st
\<train_on_grid>
train = pd.read_csv(".. /input/ykc-cup-1st/train.csv")
 train.head()
\<train_on_grid>
test = pd.read_csv(".. /input/ykc-cup-1st/test.csv")
 test.head()
\<save_to_csv>
sample_submission = pd.read_csv(".. /input/ykc-cup-1st/sample_submission.csv")
 sample_submission.head()
lcc=submission["ConfirmedCases"]
lf=submission["Fatalities"]
buscc = submission_dataset["ConfirmedCases"]
busf = submission_dataset["Fatalities"]
sdfcc = sub_df["ConfirmedCases"]
sdff = sub_df["Fatalities"]
sub_df["ConfirmedCases"] = 0.1 * buscc.values + 0.70 * sdfcc.values + 0.20 *lcc.values
sub_df["Fatalities"] = 0.1 * busf.values + 0.70 * sdff.values + 0.20 * lf.values
sub_df.to_csv('submission.csv',index=False )<set_options>
cat = ["store_id", "genre_name", "area_name", "day_of_week"]
for c in cat:
le = LabelEncoder()
train[c] = le.fit_transform(train[c].fillna("na"))
test[c] = le.transform(test[c].fillna("na"))
train.head()
%matplotlib inline 
<load_from_csv>
features = ["store_id", "day_of_week", "genre_name", "area_name", "latitude", "longitude"]
target = "log_visitors"
n_split = 5
filename = ".. /input/covid19-global-forecasting-week-2/train.csv"
dt = pd.read_csv(filename)
<load_from_csv>
preds_test = []
kfold = KFold(n_splits=n_split, shuffle = True, random_state=42)
 for i_fold,(train_idx, valid_idx)in enumerate(kfold.split(train)) :
print(f"--------fold {i_fold}-------")
 x_tr = train.loc[train_idx, features]
y_tr = train.loc[train_idx, target]
x_va = train.loc[valid_idx, features]
y_va = train.loc[valid_idx, target]
model = LGBMRegressor()
model.fit(x_tr, y_tr)
 pred_val = model.predict(x_va)
 rmse = np.sqrt(np.mean(( pred_val - y_va)** 2))
corr = np.corrcoef(pred_val, y_va)[0,1]
print("rmse : ", rmse)
 print("corr : ", corr)
 pred_test = model.predict(test[features])
 preds_test.append(pred_test )
series = read_csv('.. /input/covid19-global-forecasting-week-2/train.csv', header=0, index_col=0, parse_dates=True, squeeze=True)
 series.plot()
pyplot.show() 
<load_from_csv>
final_pred = np.mean(np.vstack(preds_test), axis = 0)
 sample_submission["log_visitors"] = final_pred
sample_submission.to_csv("submission.csv", index = False )