0
$\begingroup$

Hello everyone can you help me to create a diagram for these F-DNN

import tensorflow as tf
print(tf.__version__)
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense,Dropout,Activation,Flatten
from tensorflow.keras.optimizers import Adam
from sklearn import metrics
num_labels=y.shape[1]
num_labels=y.shape[1]
model = Sequential()
model.add(Dense(64, activation='relu', input_shape=(40,)))  
model.add(Dense(32, activation='relu'))
model.add(Dense(6, activation='softmax'))  
model.build()
model.summary()
model.compile(loss='categorical_crossentropy',metrics=['accuracy'],optimizer='adam')
from tensorflow.keras.callbacks import ModelCheckpoint
from datetime import datetime 

num_epochs = 100
num_batch_size = 32

checkpointer = ModelCheckpoint(filepath='model/pet_bark_classification.h5', 
                               verbose=1, save_best_only=True)

start = datetime.now()

model.fit(X_train, y_train, batch_size=num_batch_size, epochs=num_epochs, validation_data=(X_test, y_test), callbacks=[checkpointer], verbose=1)


duration = datetime.now() - start
print("Training completed in time: ", duration)
test_accuracy = model.evaluate(X_test, y_test, verbose=0)
print(f"Test Accuracy: {test_accuracy[1] * 100:.2f}%")
prediction_feature = np.array([1.0, 2.0, 3.0, 4.0])

shape = prediction_feature.shape
X_test[1]
print(shape)
predicted_probabilities = model.predict(X_test)

predicted_classes = np.argmax(predicted_probabilities, axis=1)
$\endgroup$
1
  • 1
    $\begingroup$ Have you tried plot_model() from keras.utils? $\endgroup$ Nov 15, 2023 at 15:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.