Kaggle competition: COVID19 Global Forecasting (Week 1)
predictions = lm.predict(X_test)
 output = pd.DataFrame({'PassengerId': test_data.PassengerId, 'Survived': predictions})
 output.to_csv('my_submission.csv', index=False)
 print("Your submission was successfully saved!" )<load_from_csv>
train = pd.read_csv("/kaggle/input/covid19-global-forecasting-week-1/train.csv")
 test = pd.read_csv("/kaggle/input/covid19-global-forecasting-week-1/test.csv")
 submission = pd.read_csv("/kaggle/input/covid19-global-forecasting-week-1/submission.csv")
 train.head()
train_data = pd.read_csv("/kaggle/input/titanic/train.csv")
 test_data = pd.read_csv("/kaggle/input/titanic/test.csv" )<categorify>
print(f'Total reported cases are {len(train)}.')
 print(f'Total confirmed cases are {int(train["ConfirmedCases"].sum())}.')
 print(f'Total fatality cases are {int(train["Fatalities"].sum())}.')
 print(f'Total countries are {len(train["Country/Region"].unique())}.' )
label_encoder_sex = LabelEncoder()<categorify>
train["Date"] = train["Date"].apply(lambda x: x.replace("-",""))
train["Date"] = train["Date"].astype(int)
 train.head()
train_data.iloc[:,4] = label_encoder_sex.fit_transform(train_data.iloc[:,4])
<categorify>
train = train.drop(['Province/State'],axis=1)
 train = train.dropna()
train.isnull().sum()
test_data.iloc[:,3] = label_encoder_sex.fit_transform(test_data.iloc[:,3] )<prepare_x_and_y>
test["Date"] = test["Date"].apply(lambda x: x.replace("-",""))
test["Date"] = test["Date"].astype(int)
 test.isnull().sum()
X_train = train_data[["PassengerId", "Sex", "SibSp", "Parch", "Pclass"]]
Y_train = train_data["Survived"]<prepare_x_and_y>
x = train[['Lat', 'Long', 'Date']]
y1 = train[['ConfirmedCases']]
y2 = train[['Fatalities']]
x_test = test[['Lat', 'Long', 'Date']]
X_test = test_data[["PassengerId", "Sex", "SibSp", "Parch", "Pclass"]]<normalization>
Tree_model = RandomForestClassifier(max_depth=200, random_state=0 )
my_imputer = SimpleImputer()
X_train1 = my_imputer.fit_transform(X_train)
 X_test1 = my_imputer.fit_transform(X_test )<normalization>
Tree_model.fit(x,y1)
 pred1 = Tree_model.predict(x_test)
 pred1 = pd.DataFrame(pred1)
 pred1.columns = ["ConfirmedCases_prediction"]
sc = StandardScaler()
X_train1 = sc.fit_transform(X_train1)
 X_test1 = sc.fit_transform(X_test1 )<import_modules>
Tree_model.fit(x,y2)
 pred2 = Tree_model.predict(x_test)
 pred2 = pd.DataFrame(pred2)
 pred2.columns = ["Death_prediction"]
import keras
from keras.models import Sequential
from keras.layers import Dense<choose_model_class>
Sub = pd.read_csv(".. /input/covid19-global-forecasting-week-1/submission.csv")
 sub_new = Sub[["ForecastId"]]
sub_new
model = Sequential()<choose_model_class>
submit = pd.concat([pred1,pred2,sub_new],axis=1)
 submit.head()
model.add(Dense(units = 4, activation = 'relu', input_dim = 5))
model.add(Dense(units = 3, activation = 'relu'))
model.add(Dense(units = 2, activation = 'relu'))
model.add(Dense(units = 1, activation = 'sigmoid')) 
<choose_model_class>
submit.columns = ['ConfirmedCases', 'Fatalities', 'ForecastId']
submit = submit[['ForecastId','ConfirmedCases', 'Fatalities']]
submit["ConfirmedCases"] = submit["ConfirmedCases"].astype(int)
 submit["Fatalities"] = submit["Fatalities"].astype(int )
model.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'] )<train_model>
submit.to_csv('submission.csv', index=False )