Kaggle competition: Santander Customer Satisfaction
layer1 = Dense(units = 10,activation = 'relu', input_dim = 7)
 layer2 = Dense(units = 15, activation = 'relu')
 layer3 = Dense(units = 2, activation = 'sigmoid')
 model = Sequential([layer1, layer2, layer3])
 model.compile(optimizer = 'adam', loss = 'sparse_categorical_crossentropy', metrics = ['accuracy'])
 clf = model.fit(x_train_scaled, y_train, batch_size = 25, epochs = 300 )<predict_on_test>
df_train = pd.read_csv('.. /input/train.csv')
 df_test = pd.read_csv('.. /input/test.csv')
 ignored_columns = ['ID', 'TARGET']
C = df_train.columns
eps = 1e-10
dropped_columns = set()
print('Identifing low-variance columns...', end=' ')
 for c in C:
if df_train[c].var() < eps:
dropped_columns.add(c)
 print('done!')
 C = list(set(C)- dropped_columns - set(ignored_columns))
print('Identifying duplicate columns...', end=' ')
 for i, c1 in enumerate(C):
f1 = df_train[c1].values
for j, c2 in enumerate(C[i+1:]):
f2 = df_train[c2].values
if np.all(f1 == f2):
dropped_columns.add(c2)
 print('done!')
 C = list(set(C)- dropped_columns - set(ignored_columns))
print('
print('
df_train.drop(dropped_columns, axis=1, inplace=True)
 df_test.drop(dropped_columns, axis=1, inplace=True )
predicted_on_test = model.predict_classes(x_test_scaled, batch_size = 25)
 confusion = confusion_matrix(y_test, predicted_on_test)
 print('Confusion Matrix
', confusion)
 print('Accuracy: {:.2f}'.format(accuracy_score(y_test, predicted_on_test)) )<normalization>
y_learning = df_train['TARGET'].values
X_learning = df_train.drop(['ID','TARGET'], axis=1 ).values
id_test = df_test['ID']
X_test = df_test.drop(['ID'], axis=1 ).values
X_train_valid, X_local_test, y_train_valid, y_local_test = train_test_split(
 X_learning, y_learning, test_size=0.168, random_state=1 
)
 X_fit, X_eval, y_fit, y_eval= train_test_split(
 X_train_valid, y_train_valid, test_size=0.2, random_state=1 
)
 print('
print('
print('
<predict_on_test><EOS> 
clf = xgb.XGBClassifier(missing=np.nan, max_depth=5,
n_estimators=1000, learning_rate=0.01,
subsample=0.5, colsample_bytree=0.9, seed=4242)
 clf.fit(X_fit, y_fit, early_stopping_rounds=50, eval_metric="auc", eval_set=[(X_eval, y_eval)])
 auc_train = roc_auc_score(y_fit, clf.predict_proba(X_fit)[:,1])
 auc_valid = roc_auc_score(y_eval, clf.predict_proba(X_eval)[:,1])
 auc_test = roc_auc_score(y_local_test, clf.predict_proba(X_local_test)[:,1])
 print('
-----------------------')
 print(' AUC train: %.5f'%auc_train)
 print(' AUC valid: %.5f'%auc_valid)
 print(' AUC test : %.5f'%auc_test)
 print('-----------------------')
 print('
Model parameters...')
 print(clf.get_params())
 print('
-----------------------
')
 y_pred= clf.predict_proba(X_test)[:,1]
submission = pd.DataFrame({"ID":id_test, "TARGET":y_pred})
 submission.to_csv("submission.csv", index=False)
 print('Completed!' )