Kaggle competition: OpenVaccine: COVID-19 mRNA Vaccine Degradation Prediction
<SOS> metric: MWCRMSE Kaggle data source: stanford-covid-vaccine<data_type_conversions>
warnings.filterwarnings('ignore')
output.ForecastId = output.ForecastId.astype('int')
 output.tail()<save_to_csv>
def seed_everything(seed = 34):
os.environ['PYTHONHASHSEED']=str(seed)
 tf.random.set_seed(seed)
 np.random.seed(seed)
 random.seed(seed)
 seed_everything()
output.to_csv('submission.csv', index=False )<load_from_csv>
train = pd.read_json('/kaggle/input/stanford-covid-vaccine/train.json', lines=True)
 test = pd.read_json('/kaggle/input/stanford-covid-vaccine/test.json', lines=True)
 sample_sub = pd.read_csv('/kaggle/input/stanford-covid-vaccine/sample_submission.csv' )
train = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-4/train.csv')
 test = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-4/test.csv')
 train['Province_State'] = train['Province_State'].replace(np.nan, 'nan', regex=True)
 train['Province_State'] = np.where(train['Province_State'] == 'nan' ,train['Country_Region'],train['Province_State'])
 test['Province_State'] = test['Province_State'].replace(np.nan, 'nan', regex=True)
 test['Province_State'] = np.where(test['Province_State'] == 'nan' ,test['Country_Region'],test['Province_State'])
 train['Date'] = pd.to_datetime(train['Date'])
 train['Days'] = train['Date']-train['Date'].min()
train['Days'] = train['Days'].dt.days.astype(int)
 train[['ConfirmedCases', 'Fatalities']] = train[['ConfirmedCases', 'Fatalities']].astype(int)
 test['Date'] = pd.to_datetime(test['Date'])
 test['Days'] = test['Date']-train['Date'].min()
test['Days'] = test['Days'].dt.days.astype(int)
 province_train = np.zeros(int(len(train)/84)).astype(object)
 province_test = np.zeros(int(len(test)/43)).astype(object)
 X_train = np.zeros(len(province_train)).astype(object)
 y_train = np.zeros(len(province_train)).astype(object)
 X_test = np.zeros(len(province_test)).astype(object)
 province_index = 0
index = 0
while province_index < len(train):
province = train['Province_State'][province_index]
country = train['Country_Region'][province_index]
province_train[index] = train[(train['Province_State'] == province)&(train['Country_Region']== country)]
X_train[index] = pd.DataFrame(province_train[index] ).iloc[:,[0,1,2,6]]
y_train[index] = pd.DataFrame(province_train[index] ).iloc[:,4:6]
index +=1
province_index += 84
province_index = 0
index = 0
while province_index < len(test):
province = test['Province_State'][province_index]
country = test['Country_Region'][province_index]
province_test[index] = test[(test['Province_State'] == province)&(test['Country_Region']== country)]
X_test[index] = pd.DataFrame(province_test[index] ).iloc[:,[0,1,2,4]]
index +=1
province_index += 43
label_encoder1 = LabelEncoder()
label_encoder2 = LabelEncoder()
for index in range(0,len(province_train)) :
X_train[index]['Province_State'] = label_encoder1.fit_transform(X_train[index]['Province_State'])
 X_train[index]['Country_Region'] = label_encoder2.fit_transform(X_train[index]['Country_Region'])
 X_test[index]['Province_State'] = label_encoder1.fit_transform(X_test[index]['Province_State'])
 X_test[index]['Country_Region'] = label_encoder2.fit_transform(X_test[index]['Country_Region'])
 model = PolynomialFeatures(degree = 4)
 X_poly = model.fit_transform(X_train[index].iloc[:,1:4])
 model.fit(X_poly, y_train[index].iloc[:,0])
 lin_reg = LinearRegression()
lin_reg.fit(X_poly, y_train[index].iloc[:,0])
 y_pred=lin_reg.predict(model.fit_transform(X_test[index].iloc[:,1:4]))
y_pred = np.around(y_pred,decimals=0 ).astype(int)
 X_test[index]['ConfirmedCases'] = np.where(y_pred < 0 ,0,y_pred)
 model = PolynomialFeatures(degree = 4)
 X_poly = model.fit_transform(X_train[index].iloc[:,1:4])
 model.fit(X_poly, y_train[index].iloc[:,0])
 lin_reg = LinearRegression()
lin_reg.fit(X_poly, y_train[index].iloc[:,1])
 y_pred=lin_reg.predict(model.fit_transform(X_test[index].iloc[:,1:4]))
y_pred = np.around(y_pred,decimals=0 ).astype(int)
 X_test[index]['Fatalities'] = np.where(y_pred <0 ,0,y_pred)
 X_test[index]['Province_State'] = province_test[index].iloc[:,1]
X_test[index]['Country_Region'] = province_test[index].iloc[:,2]
test_final = pd.DataFrame([])
 for i in range(0, len(X_test)) :
test_final = pd.concat([test_final, X_test[i]], ignore_index=True)
 test['ConfirmedCases'] = test_final['ConfirmedCases']
test['Fatalities'] = test_final['Fatalities']
test[(test['Days'] >=71)&(test['Days']<=83)]['ConfirmedCases'] = train[(train['Days'] >=71)&(train['Days']<=83)]['ConfirmedCases']
test[(test['Days'] >=71)&(test['Days']<=83)]['Fatalities'] = train[(train['Days'] >=71)&(train['Days']<=83)]['Fatalities']
replace_train_index = train.index[(train['Days'] >=71)&(train['Days']<=83)].values
replace_test_index = test.index[(test['Days'] >=71)&(test['Days']<=83)].values
index = 0
for i in replace_test_index:
test.set_value(i,'ConfirmedCases', train.iloc[replace_train_index[index],4])
 test.set_value(i,'Fatalities', train.iloc[replace_train_index[index],5])
 index += 1
submission = test.iloc[:,[0,5,6]]
submission.to_csv('submission.csv', index=False)
<set_options>
target_cols = ['reactivity', 'deg_Mg_pH10', 'deg_pH10', 'deg_Mg_50C', 'deg_50C']
sns.set_style('darkgrid')
 %matplotlib inline
warnings.filterwarnings('ignore')
<load_from_csv>
token2int = {x:i for i, x in enumerate('().ACGUBEHIMSX')}
df_train = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-4/train.csv')
 df_test = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-4/test.csv' )<data_type_conversions>
def preprocess_inputs(df, cols=['sequence', 'structure', 'predicted_loop_type']):
return np.transpose(
 np.array(
 df[cols] 
.applymap(lambda seq: [token2int[x] for x in seq])
.values 
.tolist() 
), 
(0, 2, 1)
 )
df_train['Date'] = pd.to_datetime(df_train['Date'], format = '%Y-%m-%d')
 df_test['Date'] = pd.to_datetime(df_test['Date'], format = '%Y-%m-%d' )<feature_engineering>
train_inputs = preprocess_inputs(train)
 train_labels = np.array(train[target_cols].values.tolist() ).transpose(( 0, 2, 1))
def add_daily_measures(df):
df.loc[0,'Daily Cases'] = df.loc[0,'ConfirmedCases']
df.loc[0,'Daily Deaths'] = df.loc[0,'Fatalities']
for i in range(1,len(df_world)) :
df.loc[i,'Daily Cases'] = df.loc[i,'ConfirmedCases'] - df.loc[i-1,'ConfirmedCases']
df.loc[i,'Daily Deaths'] = df.loc[i,'Fatalities'] - df.loc[i-1,'Fatalities']
df.loc[0,'Daily Cases'] = 0
df.loc[0,'Daily Deaths'] = 0
return df<groupby>
def rmse(y_actual, y_pred):
mse = tf.keras.losses.mean_squared_error(y_actual, y_pred)
 return K.sqrt(mse)
 def mcrmse(y_actual, y_pred, num_scored=len(target_cols)) :
score = 0
for i in range(num_scored):
score += rmse(y_actual[:, :, i], y_pred[:, :, i])/ num_scored
return score
df_world = df_train.copy()
df_world = df_world.groupby('Date',as_index=False)['ConfirmedCases','Fatalities'].sum()
df_world = add_daily_measures(df_world )<categorify>
def gru_layer(hidden_dim, dropout):
return tf.keras.layers.Bidirectional(
 tf.keras.layers.GRU(hidden_dim,
dropout=dropout,
return_sequences=True,
kernel_initializer='orthogonal'))
def lstm_layer(hidden_dim, dropout):
return tf.keras.layers.Bidirectional(
 tf.keras.layers.LSTM(hidden_dim,
dropout=dropout,
return_sequences=True,
kernel_initializer='orthogonal'))
def build_model(gru=1, seq_len=107, pred_len=68, dropout=0.4,
embed_dim=100, hidden_dim=128, layers=3):
inputs = tf.keras.layers.Input(shape=(seq_len, 3))
embed = tf.keras.layers.Embedding(input_dim=len(token2int), output_dim=embed_dim )(inputs)
 reshaped = tf.reshape(
 embed, shape=(-1, embed.shape[1], embed.shape[2] * embed.shape[3]))
hidden = tf.keras.layers.SpatialDropout1D (.2 )(reshaped)
 if gru==1:
hidden = gru_layer(hidden_dim, dropout )(hidden)
 hidden = gru_layer(hidden_dim, dropout )(hidden)
 hidden = gru_layer(hidden_dim, dropout )(hidden)
 elif gru==0:
hidden = lstm_layer(hidden_dim, dropout )(hidden)
 hidden = lstm_layer(hidden_dim, dropout )(hidden)
 hidden = lstm_layer(hidden_dim, dropout )(hidden)
 elif gru==3:
hidden = gru_layer(hidden_dim, dropout )(hidden)
 hidden = gru_layer(hidden_dim, dropout )(hidden)
 hidden = lstm_layer(hidden_dim, dropout )(hidden)
 elif gru==4:
hidden = lstm_layer(hidden_dim, dropout )(hidden)
 hidden = gru_layer(hidden_dim, dropout )(hidden)
 hidden = lstm_layer(hidden_dim, dropout )(hidden)
 elif gru==5:
hidden = lstm_layer(hidden_dim, dropout )(hidden)
 hidden = gru_layer(hidden_dim, dropout )(hidden)
 hidden = gru_layer(hidden_dim, dropout )(hidden)
 truncated = hidden[:, :pred_len]
out = tf.keras.layers.Dense(5, activation='linear' )(truncated)
 model = tf.keras.Model(inputs=inputs, outputs=out)
 adam = tf.optimizers.Adam()
radam = tfa.optimizers.RectifiedAdam()
lookahead = tfa.optimizers.Lookahead(adam, sync_period=6)
 ranger = tfa.optimizers.Lookahead(radam, sync_period=6)
 model.compile(optimizer=adam, loss=mcrmse)
 return model
df_map = df_train.copy()
df_map['Date'] = df_map['Date'].astype(str)
 df_map = df_map.groupby(['Date','Country_Region'], as_index=False)['ConfirmedCases','Fatalities'].sum()<feature_engineering>
FOLDS = 5
EPOCHS = 100
REPEATS = 1
BATCH_SIZE = 64
VERBOSE = 2
SEED = 34
def create_features(df):
df['day'] = df['Date'].dt.day
df['month'] = df['Date'].dt.month
df['dayofweek'] = df['Date'].dt.dayofweek
df['dayofyear'] = df['Date'].dt.dayofyear
df['quarter'] = df['Date'].dt.quarter
df['weekofyear'] = df['Date'].dt.weekofyear
return df<split>
public_df = test.query("seq_length == 107" ).copy()
private_df = test.query("seq_length == 130" ).copy()
public_inputs = preprocess_inputs(public_df)
 private_inputs = preprocess_inputs(private_df )
def train_dev_split(df, days):
date = df['Date'].max() - dt.timedelta(days=days)
 return df[df['Date'] <= date], df[df['Date'] > date]<feature_engineering>
lr_callback = tf.keras.callbacks.ReduceLROnPlateau()
df_train = create_features(df_train )<split>
gru_histories = []
gru_private_preds = np.zeros(( private_df.shape[0], 130, 5))
gru_public_preds = np.zeros(( public_df.shape[0], 107, 5))
rskf = RepeatedStratifiedKFold(FOLDS, n_repeats = REPEATS, random_state = SEED)
 for f,(train_index, val_index)in enumerate(rskf.split(train_inputs, train['SN_filter'])) :
sv_gru = tf.keras.callbacks.ModelCheckpoint(f'gru-{f}.h5')
 train_ = train_inputs[train_index]
train_labs = train_labels[train_index]
val_ = train_inputs[val_index]
val_labs = train_labels[val_index]
gru = build_model(gru=1)
 history = gru.fit(train_, train_labs,
validation_data=(val_,val_labs),
batch_size=BATCH_SIZE,
epochs=EPOCHS,
callbacks=[lr_callback,sv_gru],
verbose = VERBOSE)
 gru_histories.append(history)
 gru_short = build_model(gru=1, seq_len=107, pred_len=107)
 gru_short.load_weights(f'gru-{f}.h5')
 gru_public_pred = gru_short.predict(public_inputs)/ FOLDS
gru_long = build_model(gru=1, seq_len=130, pred_len=130)
 gru_long.load_weights(f'gru-{f}.h5')
 gru_private_pred = gru_long.predict(private_inputs)/ FOLDS * REPEATS
gru_public_preds += gru_public_pred
gru_private_preds += gru_private_pred
del gru_short, gru_long
df_train, df_dev = train_dev_split(df_train,0 )<drop_column>
lstm_histories = []
lstm_private_preds = np.zeros(( private_df.shape[0], 130, 5))
lstm_public_preds = np.zeros(( public_df.shape[0], 107, 5))
rskf = RepeatedStratifiedKFold(FOLDS, n_repeats = REPEATS, random_state = SEED)
 for f,(train_index, val_index)in enumerate(rskf.split(train_inputs, train['SN_filter'])) :
sv_gru = tf.keras.callbacks.ModelCheckpoint(f'lstm-{f}.h5')
 train_ = train_inputs[train_index]
train_labs = train_labels[train_index]
val_ = train_inputs[val_index]
val_labs = train_labels[val_index]
lstm = build_model(gru=0)
 history = lstm.fit(
 train_, train_labs,
validation_data=(val_,val_labs),
batch_size=BATCH_SIZE,
epochs=EPOCHS,
callbacks=[lr_callback,sv_gru],
verbose = VERBOSE)
 lstm_histories.append(history)
 lstm_short = build_model(gru=0, seq_len=107, pred_len=107)
 lstm_short.load_weights(f'lstm-{f}.h5')
 lstm_public_pred = lstm_short.predict(public_inputs)/ FOLDS
lstm_long = build_model(gru=0, seq_len=130, pred_len=130)
 lstm_long.load_weights(f'lstm-{f}.h5')
 lstm_private_pred = lstm_long.predict(private_inputs)/ FOLDS * REPEATS
lstm_public_preds += lstm_public_pred
lstm_private_preds += lstm_private_pred
del lstm_short, lstm_long
columns = ['day','month','dayofweek','dayofyear','quarter','weekofyear','Province_State', 'Country_Region','ConfirmedCases','Fatalities']
df_train = df_train[columns]
df_dev = df_dev[columns]<categorify>
hyb1_histories = []
hyb1_private_preds = np.zeros(( private_df.shape[0], 130, 5))
hyb1_public_preds = np.zeros(( public_df.shape[0], 107, 5))
rskf = RepeatedStratifiedKFold(FOLDS, n_repeats = REPEATS, random_state = SEED)
 for f,(train_index, val_index)in enumerate(rskf.split(train_inputs, train['SN_filter'])) :
sv_gru = tf.keras.callbacks.ModelCheckpoint(f'hyb1-{f}.h5')
 train_ = train_inputs[train_index]
train_labs = train_labels[train_index]
val_ = train_inputs[val_index]
val_labs = train_labels[val_index]
lstm = build_model(gru=3)
 history = lstm.fit(
 train_, train_labs,
validation_data=(val_,val_labs),
batch_size=BATCH_SIZE,
epochs=EPOCHS,
callbacks=[lr_callback,sv_gru],
verbose = VERBOSE)
 hyb1_histories.append(history)
 hyb1_short = build_model(gru=3, seq_len=107, pred_len=107)
 hyb1_short.load_weights(f'hyb1-{f}.h5')
 hyb1_public_pred = hyb1_short.predict(public_inputs)/ FOLDS
hyb1_long = build_model(gru=3, seq_len=130, pred_len=130)
 hyb1_long.load_weights(f'hyb1-{f}.h5')
 hyb1_private_pred = hyb1_long.predict(private_inputs)/ FOLDS * REPEATS
hyb1_public_preds += hyb1_public_pred
hyb1_private_preds += hyb1_private_pred
del hyb1_short, hyb1_long
df_train.Province_State.fillna('NaN', inplace=True)
 df_test.Province_State.fillna('NaN', inplace=True)
 df_test = create_features(df_test)
 columns = ['day','month','dayofweek','dayofyear','quarter','weekofyear']<prepare_x_and_y>
hyb2_histories = []
hyb2_private_preds = np.zeros(( private_df.shape[0], 130, 5))
hyb2_public_preds = np.zeros(( public_df.shape[0], 107, 5))
rskf = RepeatedStratifiedKFold(FOLDS, n_repeats = REPEATS, random_state = SEED)
 for f,(train_index, val_index)in enumerate(rskf.split(train_inputs, train['SN_filter'])) :
sv_gru = tf.keras.callbacks.ModelCheckpoint(f'hyb2-{f}.h5')
 train_ = train_inputs[train_index]
train_labs = train_labels[train_index]
val_ = train_inputs[val_index]
val_labs = train_labels[val_index]
lstm = build_model(gru=5)
 history = lstm.fit(
 train_, train_labs,
validation_data=(val_,val_labs),
batch_size=BATCH_SIZE,
epochs=EPOCHS,
callbacks=[lr_callback,sv_gru],
verbose = VERBOSE)
 hyb2_histories.append(history)
 hyb2_short = build_model(gru=5, seq_len=107, pred_len=107)
 hyb2_short.load_weights(f'hyb2-{f}.h5')
 hyb2_public_pred = hyb2_short.predict(public_inputs)/ FOLDS
hyb2_long = build_model(gru=5, seq_len=130, pred_len=130)
 hyb2_long.load_weights(f'hyb2-{f}.h5')
 hyb2_private_pred = hyb2_long.predict(private_inputs)/ FOLDS * REPEATS
hyb2_public_preds += hyb2_public_pred
hyb2_private_preds += hyb2_private_pred
del hyb2_short, hyb2_long
submission = []
for country in df_train.Country_Region.unique() :
df_train1 = df_train[df_train["Country_Region"]==country]
for state in df_train1.Province_State.unique() :
df_train2 = df_train1[df_train1["Province_State"]==state]
df_train3 = df_train2.drop(['Country_Region','Province_State'], axis=1)
 train = df_train3.values
X_train, y_train = train[:,:-2], train[:,-2:]
model1 = XGBRegressor(random_state=1,n_estimators=1000)
 model1.fit(X_train, y_train[:,0])
 model2 = XGBRegressor(random_state=1,n_estimators=1000)
 model2.fit(X_train, y_train[:,1])
 df_test1 = df_test[(df_test["Country_Region"]==country)&(df_test["Province_State"] == state)]
ForecastId = df_test1.ForecastId.values
df_test2 = df_test1[columns]
y_pred1 = model1.predict(df_test2.values ).astype(int)
 y_pred2 = model2.predict(df_test2.values ).astype(int)
 for i in range(len(y_pred1)) :
d = {'ForecastId':ForecastId[i], 'ConfirmedCases':y_pred1[i], 'Fatalities':y_pred2[i]}
submission.append(d )<create_dataframe>
public_df = test.query("seq_length == 107" ).copy()
private_df = test.query("seq_length == 130" ).copy()
public_inputs = preprocess_inputs(public_df)
 private_inputs = preprocess_inputs(private_df )
df_submit = pd.DataFrame(submission )<save_to_csv>
preds_gru = []
for df, preds in [(public_df, gru_public_preds),(private_df, gru_private_preds)]:
for i, uid in enumerate(df.id):
single_pred = preds[i]
single_df = pd.DataFrame(single_pred, columns=target_cols)
 single_df['id_seqpos'] = [f'{uid}_{x}' for x in range(single_df.shape[0])]
preds_gru.append(single_df)
 preds_gru_df = pd.concat(preds_gru)
 preds_gru_df.head()
df_submit.to_csv(r'submission.csv', index=False )<import_modules>
preds_lstm = []
for df, preds in [(public_df, lstm_public_preds),(private_df, lstm_private_preds)]:
for i, uid in enumerate(df.id):
single_pred = preds[i]
single_df = pd.DataFrame(single_pred, columns=target_cols)
 single_df['id_seqpos'] = [f'{uid}_{x}' for x in range(single_df.shape[0])]
preds_lstm.append(single_df)
 preds_lstm_df = pd.concat(preds_lstm)
 preds_lstm_df.head()
warnings.filterwarnings('ignore')
<load_from_csv>
preds_hyb1 = []
for df, preds in [(public_df, hyb1_public_preds),(private_df, hyb1_private_preds)]:
for i, uid in enumerate(df.id):
single_pred = preds[i]
single_df = pd.DataFrame(single_pred, columns=target_cols)
 single_df['id_seqpos'] = [f'{uid}_{x}' for x in range(single_df.shape[0])]
preds_hyb1.append(single_df)
 preds_hyb1_df = pd.concat(preds_hyb1)
 preds_hyb1_df.head()
training_data = pd.read_csv('.. /input/covid19-global-forecasting-week-4/train.csv')
 testing_data = pd.read_csv('.. /input/covid19-global-forecasting-week-4/test.csv' )<count_missing_values>
preds_hyb2 = []
for df, preds in [(public_df, hyb2_public_preds),(private_df, hyb2_private_preds)]:
for i, uid in enumerate(df.id):
single_pred = preds[i]
single_df = pd.DataFrame(single_pred, columns=target_cols)
 single_df['id_seqpos'] = [f'{uid}_{x}' for x in range(single_df.shape[0])]
preds_hyb2.append(single_df)
 preds_hyb2_df = pd.concat(preds_hyb2)
 preds_hyb2_df.head()
print(training_data.isnull().sum())
 print(testing_data.isnull().sum())
 print(training_data.dtypes)
 print(testing_data.dtypes)
 training_data['Province_State'].fillna("",inplace = True)
 testing_data['Province_State'].fillna("",inplace = True )<feature_engineering>
blend_preds_df = pd.DataFrame()
blend_preds_df['id_seqpos'] = preds_gru_df['id_seqpos']
blend_preds_df['reactivity'] = 0.25*preds_gru_df['reactivity'] + 0.25*preds_lstm_df['reactivity'] + 0.25*preds_hyb1_df['reactivity'] + 0.25*preds_hyb2_df['reactivity']
blend_preds_df['deg_Mg_pH10'] = 0.25*preds_gru_df['deg_Mg_pH10'] + 0.25*preds_lstm_df['deg_Mg_pH10'] + 0.25*preds_hyb1_df['deg_Mg_pH10'] + 0.25*preds_hyb2_df['deg_Mg_pH10']
blend_preds_df['deg_pH10'] = 0.25*preds_gru_df['deg_pH10'] + 0.25*preds_lstm_df['deg_pH10'] + 0.25*preds_hyb1_df['deg_pH10'] + 0.25*preds_hyb2_df['deg_pH10']
blend_preds_df['deg_Mg_50C'] = 0.25*preds_gru_df['deg_Mg_50C'] + 0.25*preds_lstm_df['deg_Mg_50C'] + 0.25*preds_hyb1_df['deg_Mg_50C'] + 0.25*preds_hyb2_df['deg_Mg_50C']
blend_preds_df['deg_50C'] = 0.25*preds_gru_df['deg_50C'] + 0.25*preds_lstm_df['deg_50C'] + 0.25*preds_hyb1_df['deg_50C'] + 0.25*preds_hyb2_df['deg_50C']
training_data['Country_Region'] = training_data['Country_Region'] + ' ' + training_data['Province_State']
testing_data['Country_Region'] = testing_data['Country_Region'] + ' ' + testing_data['Province_State']
del training_data['Province_State']
del testing_data['Province_State']
def split_date(date):
date = date.split('-')
 date[0] = int(date[0])
 if(date[1][0] == '0'):
date[1] = int(date[1][1])
 else:
date[1] = int(date[1])
 if(date[2][0] == '0'):
date[2] = int(date[2][1])
 else:
date[2] = int(date[2])
 return date
training_data.Date = training_data.Date.apply(split_date)
 testing_data.Date = testing_data.Date.apply(split_date )<feature_engineering>
submission = sample_sub[['id_seqpos']].merge(blend_preds_df, on=['id_seqpos'])
 submission.head()
<normalization><EOS> 
submission.to_csv('submission.csv', index=False)
 print('Submission saved' )