Kaggle competition: University of Liverpool - Ion Switching
oof_start = np.zeros(( input_ids.shape[0],MAX_LEN))
oof_end = np.zeros(( input_ids.shape[0],MAX_LEN))
oof_start,oof_end = model.predict([input_ids[:800],attention_mask[:800],token_type_ids[:800]],verbose=1 )<categorify>
submit = pd.read_csv("/kaggle/input/liverpool-ion-switching/sample_submission.csv")
 paths = {
"wavenet": "/kaggle/input/wavenet-keras/submission.csv",
"kalman": "/kaggle/input/single-model-lgbm-kalman-filter/submission.csv",
"rnn": "/kaggle/input/seq2seq-rnn-with-gru/gru_preds.csv",
"lgb-fe": "/kaggle/input/lgb-featureengineering-lb-0-940/submission.csv",
"lstm": "/kaggle/input/simple-two-layer-bidirectional-lstm-with-pytorch/submission_bilstm.csv",
}
weights = np.array([0.941, 0.94, 0.94, 0.94, 0.94])
 subs = submit.copy()
for i, p in enumerate(paths.keys()):
tmp = pd.read_csv(paths[p])
 subs[f"{p}"] = tmp["open_channels"]
subs.drop(columns=["time", "open_channels"], inplace=True )
all = []
jac = []
for k in range(800):
a = np.argmax(oof_start[k,])
 b = np.argmax(oof_end[k,])
 if a>b:
st = train.loc[k,'text']
else:
text1 = " "+" ".join(train.loc[k,'text'].split())
 enc = tokenizer.encode(text1)
 st = tokenizer.decode(enc.ids[a-1:b])
 all.append(jaccard(st,train.loc[k,'selected_text']))
jac.append(np.mean(all))<predict_on_test>
def weighted_voting(row):
h = np.histogram(row.values, weights=weights)
 return np.round(h[1][np.argmax(h[0])] )
preds = model.predict([input_ids_t ,attention_mask_t ,token_type_ids_t] ,verbose = 1)
 preds_start = preds[0]
preds_end = preds[1]<string_transform>
submit["open_channels"] = subs.apply(weighted_voting, axis=1 )
<save_to_csv><EOS> 
submit["open_channels"] = submit["open_channels"].astype(int)
 submit.to_csv('submission_voting.csv', index=False, float_format='%.4f' )