Kaggle competition: Santander Customer Satisfaction
<SOS> metric: AUC Kaggle data source: santander-customer-satisfaction<feature_engineering>
sns.set_style('whitegrid')
 %matplotlib inline
X_train = X_train / 255.0
test = test / 255.0<categorify>
santander_df = pd.read_csv(".. /input/train.csv")
 test_df = pd.read_csv(".. /input/test.csv")
 santander_df.head()
y_train = to_categorical(y_train, num_classes = 10 )<split>
columns_to_be_removed = []
cunt_constant = 0
for col in santander_df.columns:
if santander_df[col].std() == 0:
columns_to_be_removed.append(col)
 cunt_constant = cunt_constant + 1
santander_df.drop(columns_to_be_removed, axis=1, inplace=True)
 test_df.drop(columns_to_be_removed, axis=1, inplace=True)
 columns_to_be_removed = []
cunt_duplicates = 0
for col_i in santander_df.columns:
for col_j in santander_df.columns:
if(col_i == col_j): continue
if(( santander_df[col_i] == santander_df[col_j] ).all()):
columns_to_be_removed.append(col_i)
 cunt_duplicates = cunt_duplicates + 1
break
santander_df.drop(columns_to_be_removed, axis=1, inplace=True)
 test_df.drop(columns_to_be_removed, axis=1, inplace=True )
random_seed = 2
X_train, X_val, y_train, y_val = train_test_split(X_train, y_train, test_size = 0.15, random_state=random_seed )<choose_model_class>
cunt_nunique = santander_df.apply(lambda col:col.nunique())
 cunt_nunique.drop("ID", inplace=True)
 cunt_nunique[cunt_nunique <= 100].hist(bins=100, figsize=(15, 5))
model = models.Sequential()<choose_model_class>
most_common_num = santander_df['var3'].value_counts().index[0]
santander_df["var3"][santander_df["var3"] == -999999] = most_common_num
model.add(Conv2D(filters = 32, kernel_size =(5,5),padding = 'Same', activation ='relu', input_shape =(28,28,1)) )<choose_model_class>
X_train = santander_df.drop(["ID","TARGET"],axis=1)
 Y_train = santander_df["TARGET"]
X_test = test_df.drop("ID",axis=1 ).copy()
model.add(Conv2D(filters = 32, kernel_size =(5,5),padding = 'Same', activation ='relu'))<choose_model_class>
logreg = LogisticRegression()
logreg.fit(X_train, Y_train)
 Y_pred = logreg.predict_proba(X_test)[:,1]
logreg.score(X_train, Y_train )
model.add(layers.MaxPooling2D(( 2, 2)) )<choose_model_class>
random_forest = RandomForestClassifier(n_estimators=100)
 random_forest.fit(X_train, Y_train)
 Y_pred = random_forest.predict_proba(X_test)[:,1]
random_forest.score(X_train, Y_train )
model.add(Dropout(0.25))<choose_model_class>
params = {"objective": "binary:logistic"}
T_train_xgb = xgb.DMatrix(X_train, Y_train)
 X_test_xgb = xgb.DMatrix(X_test)
 gbm = xgb.train(params, T_train_xgb, 20)
 Y_pred = gbm.predict(X_test_xgb )
model.add(Conv2D(filters = 64, kernel_size =(3,3),padding = 'Same', activation ='relu'))<choose_model_class>
coeff_df = DataFrame(X_train.columns)
 coeff_df.columns = ['Features']
coeff_df["Coefficient Estimate"] =(pd.Series(logreg.coef_[0])) ** 2
coeff_df.head()
model.add(Conv2D(filters = 64, kernel_size =(3,3),padding = 'Same', activation ='relu'))<choose_model_class>
submission = pd.DataFrame()
submission["ID"] = test_df["ID"]
submission["TARGET"] = Y_pred
submission.to_csv('santander.csv', index=False )