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
y_pred = model.predict_classes(X_test) | |
y_pred |
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
print(classification_report(y_true,y_pred)) |
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
y_pred = model.predict_classes(X_test) | |
y_true = np.argmax(y_test, axis = 1) | |
cf=confusion_matrix(y_true, y_pred) | |
sns.heatmap(cf, annot=True) |
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
model.evaluate(X_test, y_test) |
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
plot_learningCurve(history, 400) |
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
def plot_learningCurve(history, epoch): | |
# Plot training & validation accuracy values | |
epoch_range = range(1, epoch+1) | |
plt.plot(epoch_range, history.history['acc']) | |
plt.plot(epoch_range, history.history['val_acc']) | |
plt.title('Model accuracy') | |
plt.ylabel('Accuracy') | |
plt.xlabel('Epoch') | |
plt.legend(['Train', 'Val'], loc='upper left') | |
plt.show() |
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
history = model.fit(X_train, y_train, | |
epochs=400, | |
validation_data=(X_test, y_test), | |
verbose=1, | |
) |
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
model.summary() |
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
model.compile(loss='categorical_crossentropy', | |
optimizer=Adam(0.0001), | |
metrics=['acc']) |
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
model = tf.keras.models.Sequential([ | |
tf.keras.layers.Dense(256, input_shape=(9,), activation='relu'), | |
tf.keras.layers.BatchNormalization(), | |
tf.keras.layers.Dropout(0.3), | |
tf.keras.layers.Dense(256, activation='relu'), | |
tf.keras.layers.BatchNormalization(), | |
tf.keras.layers.Dropout(0.3), |
NewerOlder