Kaggle competition: TReNDS Neuroimaging
<SOS> metric: WMAE Kaggle data source: trends-neuroimaging<predict_on_test>
sns.set_context("talk")
 style.use('fivethirtyeight')
test_ds = get_test_dataset(ordered=True)
 print('Computing predictions...')
 test_images_ds = test_ds.map(lambda image, idnum: image)
 probabilities = model.predict(test_images_ds)
 predictions = np.argmax(probabilities, axis=-1)
 print(predictions )<save_to_csv>
BASE_PATH = ".. /input/trends-assessment-prediction"
SUBMISSION_FILES_PATH = ".. /input/trends-master-ensemble"
submission = pd.read_csv(f"{BASE_PATH}/sample_submission.csv")
 ENSEMBLES = [
{"file0": f"{SUBMISSION_FILES_PATH}/submission_rapids_ensemble.csv", "weight": 1.1},
{"file1": f"{SUBMISSION_FILES_PATH}/sub.csv", "weight": 1.13},
{"file2": f"{SUBMISSION_FILES_PATH}/submission.csv", "weight": 1.1},
{"file3": f"{SUBMISSION_FILES_PATH}/submission1.csv", "weight": 1},
{"file4": f"{SUBMISSION_FILES_PATH}/submission_ridge.csv", "weight": 1.12},
]
print('Generating submission.csv file...')
 test_ids_ds = test_ds.map(lambda image, idnum: idnum ).unbatch()
test_ids = next(iter(test_ids_ds.batch(NUM_TEST_IMAGES)) ).numpy().astype('U')
 np.savetxt(
 'submission.csv',
np.rec.fromarrays([test_ids, predictions]),
fmt=['%s', '%d'],
delimiter=',',
header='id,label',
comments='', 
)
 !head submission.csv<install_modules>
subs = submission.copy()
for i, ensemble in enumerate(ENSEMBLES):
print(ensemble)
 tmp = pd.read_csv(ensemble[f'file{i}'])
 subs[f"predicted_file{i}"] = tmp["Predicted"]
subs.drop(columns=["Id", "Predicted"], inplace=True )
!pip install -q efficientnet<set_options>
def mean_ensemble(row):
return np.mean(row.values )
<define_variables><EOS> 
submission["Predicted"] = subs.apply(mean_ensemble, axis=1)
 submission.to_csv("submission.csv", index=False )