I have created a Keras Classifier for k fold validation. Below is the function for building the classifer.
def build_classifier():
classifier = Sequential()
classifier.add(Dense(activation="relu", input_dim=11, units=6, kernel_initializer="uniform"))
classifier.add(Dense(activation="relu", units=6, kernel_initializer="uniform"))
classifier.add(Dense(activation="sigmoid", units=1, kernel_initializer="uniform"))
classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])
return classifier
I have initialized the classifier as below.
classfier = KerasClassifier(build_fn = build_classifier, batch_size=10, epochs=100)
I am trying to get the accuracy score from this 10 fold validation.
accuracies = cross_val_score(estimator = classifier, X = X_train, y = y_train, cv = 10, n_jobs = -1)
However it show me a TypeError:
TypeError: If no scoring is specified, the estimator passed should have a 'score' method. The estimator does not.