Kaggle competition: SIIM-ISIC Melanoma Classification
<SOS> metric: MCAUC Kaggle data source: siim-isic-melanoma-classification<train_model>
DATA_PATH = '/kaggle/input/efficientbx-melanoma-classification-with-tf'
history_files = [f for f in listdir(DATA_PATH)if isfile(join(DATA_PATH, f)) and f.split('_')[0] == 'history']
submit_files = [f for f in listdir(DATA_PATH)if isfile(join(DATA_PATH, f)) and f.split('_')[0] == 'submit']
modell = ensemble.GradientBoostingRegressor(n_estimators = 3000, max_depth = 5,max_features='sqrt', min_samples_split = 10,
learning_rate = 0.005,loss = 'huber',min_samples_leaf=15,random_state =42)
 modell.fit(x_train, y_train )<predict_on_test>
list_results = []
for file_name_i in history_files:
model_name_i = file_name_i[8:22]
fold_name_i = file_name_i[23:29]
df_i = pd.read_csv(os.path.join(DATA_PATH, file_name_i), index_col=0)
 auc_i = df_i[df_i.val_loss == df_i.val_loss.min() ]['val_auc'].iloc[0]
loss_i = df_i.val_loss.min()
list_results.append([model_name_i, fold_name_i, auc_i, loss_i])
 df_results = pd.DataFrame(list_results, columns = ['Model', 'Fold', 'AUC', 'Loss'])
 for model_name_i in df_results.Model.unique() :
mean_auc_i = df_results.AUC[df_results.Model == model_name_i].mean()
mean_loss_i = df_results.Loss[df_results.Model == model_name_i].mean()
df_i = pd.DataFrame([[model_name_i, 'mean_fold', mean_auc_i, mean_loss_i]], columns = ['Model', 'Fold', 'AUC', 'Loss'])
 df_results = pd.concat([df_results, df_i])
 df_results = df_results.sort_values(by = ['Model', 'Fold'], ascending = True ).reset_index().drop(columns = ['index'] )
pred = modell.predict(x_test )<compute_test_metric>
model_names = ['EfficientNetB' + str(i)for i in range(8)]
fold_names = ['fold_' + str(i)for i in range(4)]
dict_df_history = {}
for model_i in model_names:
dict_df_history[model_i] = {}
for fold_i in fold_names:
file_name_i = 'history_' + model_i + '_' + fold_i + '.csv'
df_history_i = pd.read_csv(os.path.join(DATA_PATH, file_name_i))
df_history_i=df_history_i.rename(columns = {
'Unnamed: 0': 'Epoch',
'loss': 'Train Loss',
'auc': 'Train AUC',
'val_loss': 'Valid Loss',
'val_auc': 'Valid AUC',
'lr': 'Learning Rate'
} 
)
 dict_df_history[model_i][fold_i] = df_history_i
<predict_on_test><EOS> 
sample_submit = pd.read_csv('/kaggle/input/siim-isic-melanoma-classification/sample_submission.csv')
 for model_name_i in model_names:
target_list = []
for fold_i in fold_names:
target_i = pd.read_csv(os.path.join(DATA_PATH, 'submit_' + model_name_i + '_' + fold_i + '.csv')) ['target'].values
target_list.append(target_i)
 df_submit_i = sample_submit.copy()
df_submit_i['target'] = np.mean(target_list, axis=0)
 df_submit_i.to_csv('submit_' + model_name_i + '_mean_fold.csv', index=False)
 print(model_name_i + ' - Mean Fold submit file saved' )