Kaggle competition: Jigsaw Multilingual Toxic Comment Classification
X_train, X_val, y_train, y_val = train_test_split(X, y, test_size=0.15, random_state=12345 )<train_model>
submission2 = pd.read_csv('/kaggle/input/009473-v/submission - 2020-06-23T075709.806.csv')
 submission1 = pd.read_csv('/kaggle/input/009488/submission - 2020-06-23T074910.830.csv')
 submission3 = pd.read_csv('.. /input/tpuinference-super-fast-xlmroberta/submission(47 ).csv' )
class Metric(Callback):
def __init__(self, model, callbacks, data):
super().__init__()
self.model = model
self.callbacks = callbacks
self.data = data
def on_train_begin(self, logs=None):
for callback in self.callbacks:
callback.on_train_begin(logs)
 def on_train_end(self, logs=None):
for callback in self.callbacks:
callback.on_train_end(logs)
 def on_epoch_end(self, batch, logs=None):
X_train, y_train = self.data[0][0], self.data[0][1]
y_pred = self.model.predict(X_train)
 y_true = np.clip(np.cumsum(y_train, axis=1), 0, 1)
 y_pred = np.clip(np.cumsum(y_pred, axis=1), 0, 1)
 tr_s =(( y_true - y_pred)** 2 ).sum(axis=1 ).sum(axis=0)/(199 * X_train.shape[0])
 tr_s = np.round(tr_s, 6)
 logs['tr_CRPS'] = tr_s
X_valid, y_valid = self.data[1][0], self.data[1][1]
y_pred = self.model.predict(X_valid)
 y_true = np.clip(np.cumsum(y_valid, axis=1), 0, 1)
 y_pred = np.clip(np.cumsum(y_pred, axis=1), 0, 1)
 val_s =(( y_true - y_pred)** 2 ).sum(axis=1 ).sum(axis=0)/(199 * X_valid.shape[0])
 val_s = np.round(val_s, 6)
 logs['val_CRPS'] = val_s
print('tr CRPS', tr_s, 'val CRPS', val_s)
 for callback in self.callbacks:
callback.on_epoch_end(batch, logs )<import_modules>
submission1['toxic'] = submission1['toxic']*0.9 + submission2['toxic']*0.1
<choose_model_class><EOS> 
submission1.to_csv('submission.csv', index=False )