Kaggle competition: SIIM-ISIC Melanoma Classification
<SOS> metric: MCAUC Kaggle data source: siim-isic-melanoma-classification<data_type_conversions>
!pip install xgboost
concated_df['Surname'] = surnames
concated_df['FamilyID'] = concated_df.Surname.str.cat(concated_df.FamilySize.astype(str),sep='')
 concated_df.head()<feature_engineering>
train= pd.read_csv('.. /input/siim-isic-melanoma-classification/train.csv')
 test= pd.read_csv('.. /input/siim-isic-melanoma-classification/test.csv')
 sub= pd.read_csv('.. /input/siim-isic-melanoma-classification/sample_submission.csv' )
concated_df.FamilyID.values[concated_df.FamilySize.values <= 2] = 'Small'
concated_df.head()<count_values>
train['sex'] = train['sex'].fillna('na')
 train['age_approx'] = train['age_approx'].fillna(0)
 train['anatom_site_general_challenge'] = train['anatom_site_general_challenge'].fillna('na')
 test['sex'] = test['sex'].fillna('na')
 test['age_approx'] = test['age_approx'].fillna(0)
 test['anatom_site_general_challenge'] = test['anatom_site_general_challenge'].fillna('na')
 train['sex'] = train['sex'].astype("category" ).cat.codes +1
train['anatom_site_general_challenge'] = train['anatom_site_general_challenge'].astype("category" ).cat.codes +1
train.head()
concated_df.FamilyID.value_counts()<count_values>
test['sex'] = test['sex'].astype("category" ).cat.codes +1
test['anatom_site_general_challenge'] = test['anatom_site_general_challenge'].astype("category" ).cat.codes +1
test.head()
freq = list(dict(zip(concated_df.FamilyID.value_counts().index.tolist() , concated_df.FamilyID.value_counts().values)).items())
 type(freq )<data_type_conversions>
x_train = train[['sex', 'age_approx','anatom_site_general_challenge']]
y_train = train['target']
x_test = test[['sex', 'age_approx','anatom_site_general_challenge']]
train_DMatrix = xgb.DMatrix(x_train, label= y_train)
 test_DMatrix = xgb.DMatrix(x_test )
freq[freq[:,1].astype(int)<= 2].shape<data_type_conversions>
clf = xgb.XGBClassifier(n_estimators=2600,
max_depth=15,
objective='multi:softprob',
seed=0,
nthread=-1,
learning_rate=0.15,
num_class = 2,
scale_pos_weight =(32542/584))
clf.fit(x_train, y_train )
freq = freq[freq[:,1].astype(int)<= 2]<count_values>
clf.predict_proba(x_test)[:,1]
sub.target = clf.predict_proba(x_test)[:,1]
sub_tabular = sub.copy()
concated_df.FamilyID.values[concated_df.FamilyID.isin(freq[:,0])] = 'Small'
concated_df.FamilyID.value_counts()<data_type_conversions>
sub_tabular.to_csv('submission_tabular.csv', index = False )
concated_reduce['Age'].fillna(concated_reduce['Age'].median() , inplace=True)
 concated_reduce['Fare'].fillna(concated_reduce['Fare'].median() , inplace=True )<split>
sub_new = pd.read_csv(".. /input/siimisic-melanoma-subs/submission_b_Fork-of-ensemble_melanoma-ac9964_AjayKumar_v12_LB0p9596.csv")
 sub_mean = pd.read_csv(".. /input/siimisic-melanoma-subs/Submissions_MeanOf_27Models_LB0pt9571.csv")
 sub_tuned = pd.read_csv(".. /input/simple-public-blender-0-930/submission.csv")
 sub.target = sub_mean.target *0.2 + sub_new.target *0.5 + sub_tabular.target *0.2 + sub_tuned.target *0.1
<prepare_x_and_y><EOS> 
sub.to_csv('ensemble_submission.csv', index = False)
 sub.head(20 )