classifier = Sequential() # Add the input layer and the first hidden layer classifier.add(Dense(units = 6, kernel_initializer = 'he_uniform',activation='relu',input_dim = 10)) # Add the second hidden layer classifier.add(Dense(units = 6, kernel_initializer = 'he_uniform',activation='relu')) # Add the output layer classifier.add(Dense(units = 1, kernel_initializer = 'glorot_uniform', activation = 'sigmoid')) # Compile the ANN classifier.compile(optimizer = 'Adamax', loss = 'binary_crossentropy', metrics = ['accuracy']) # Fitting the ANN to the Training set model_history=classifier.fit(X_train, y_train, batch_size = 10, epochs = 100) # list all data in history classifier.summary() #total params are total number of weights and biases """### **5. Model Evaluation**""" # Predict the Test set results Y_pred = classifier.predict(X_test) Y_pred Y_pred = (Y_pred > 0.5) Y_pred # Confusion Matrix from sklearn.metrics import confusion_matrix cm = confusion_matrix(y_test, Y_pred) print(cm) # Calculate the Accuracy from sklearn.metrics import accuracy_score score=accuracy_score(Y_pred,y_test) print(score)
To embed this project on your website, copy the following code and paste it into your website's HTML: