text_plain_output_1.png
"""
from keras.wrappers.scikit_learn import KerasClassifier #this is used to wrap sklearn in keras
from sklearn.model_selection import GridSearchCV
def ann_classifier(optimizer):
  classifier=Sequential()  #this is the local classifier
  classifier.add(Dense(units=6, kernel_initializer="uniform")) 
  classifier.add(LeakyReLU(alpha=0.1))
  classifier.add(Dense(units=6, kernel_initializer="uniform")) 
  classifier.add(LeakyReLU(alpha=0.1)) 
  classifier.add(Dense(units=1, kernel_initializer="uniform",activation="sigmoid")) 
  classifier.compile(optimizer =optimizer , loss = 'binary_crossentropy', metrics = ['accuracy'])
  return classifier
#global Classifier
global_classifier=KerasClassifier(build_fn=ann_classifier)
#declaring the parameters
parameter={'batch_size':[25,32],'epochs':[100,200],'optimizer':['adam','rmsprop']}
grid_search=GridSearchCV(estimatior=global_classifier,param_grid=parameter,scoring='accuracy',cv=5, n_jobs=-1)
grid_search=grid_search.fit(X_train,y_train)
best_parameters=grid_search.best_params_
best_accuracies=grid_search.best_score_
"""