Kaggle competition: TReNDS Neuroimaging
<SOS> metric: WMAE Kaggle data source: trends-neuroimaging<feature_engineering>
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
SEED = 42
os.environ['PYTHONHASHSEED']=str(SEED)
 random.seed(SEED)
 np.random.seed(SEED )<categorify>
submission1 = pd.read_csv('/kaggle/input/trends-neuroimaging-blending/submission_rapids_ensemble.csv')
 submission2 = pd.read_csv('/kaggle/input/trends-neuroimaging-blending/submission(62 ).csv')
def translate(words, dest):
dest_choices = ['zh-cn',
'ar',
'fr',
'sw',
'ur',
'vi',
'ru',
'hi',
'el',
'th',
'es',
'de',
'tr',
'bg'
]
if not dest:
dest = np.random.choice(dest_choices)
 translator = Translator()
decoded = translator.translate(words, dest=dest ).text
return decoded
def trans_parallel(df, dest):
premise_bag = bag.from_sequence(df.premise.tolist() ).map(translate, dest)
 hypo_bag = bag.from_sequence(df.hypothesis.tolist() ).map(translate, dest)
 with diagnostics.ProgressBar() :
premises = premise_bag.compute()
hypos = hypo_bag.compute()
df[['premise', 'hypothesis']] = list(zip(premises, hypos))
return df<categorify>
submission1['Predicted'] = submission1['Predicted']*0.4 + submission2['Predicted']*0.6
eng = train.loc[train.lang_abv == "en"].copy().pipe(trans_parallel, dest=None)
 non_eng = train.loc[train.lang_abv != "en"].copy().pipe(trans_parallel, dest='en')
 train_data_translate = train.append([eng, non_eng] )<concatenate>
submission1.to_csv('submission.csv', index=False )