Last active
January 1, 2019 17:50
-
-
Save prashant2018/84eda8965ad12dc1fb88a3074e675cec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import keras | |
from keras.models import Sequential | |
from keras.layers import Dense | |
def build_classifier(): | |
classifier = Sequential() | |
classifier.add(Dense(units=6, kernel_initializer='uniform', activation='relu', input_dim=11)) | |
classifier.add(Dense(units=6, kernel_initializer='uniform', activation='relu')) | |
classifier.add(Dense(units=1, kernel_initializer='uniform', activation='sigmoid')) | |
classifier.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy']) | |
return classifier | |
from keras.wrappers.scikit_learn import KerasClassifier | |
from sklearn.model_selection import cross_val_score | |
classifier = KerasClassifier(build_fn = build_classifier, batch_size=10, nb_epoch=100) | |
accuracies = cross_val_score(estimator = classifier, X=X_train,y=y_train, cv=10, n_jobs=-1) | |
mean = accuracies.mean() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment