Created
July 14, 2022 16:48
-
-
Save Abhayparashar31/f874c0f833ae59bd64af50e8aa7ea935 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 tensorflow as tf | |
from tensorflow.keras.models import Sequential | |
from tensorflow.keras.layers import Dense,Reshape | |
from tensorflow.keras.layers import Dropout | |
def create_model(): | |
# create model | |
model = Sequential() | |
model.add(Dense(60, input_shape=(60,), activation='relu', kernel_regularizer=keras.regularizers.l1(0.01))) | |
model.add(Dropout(0.2)) | |
model.add(Dense(30, activation='relu', kernel_regularizer=keras.regularizers.l2(0.001))) | |
model.add(Dropout(0.2)) | |
model.add(Dense(1, activation='sigmoid')) | |
return model | |
adam = tf.keras.optimizers.Adam() | |
model.compile(loss='binary_crossentropy', optimizer=adam, metrics=['accuracy']) | |
model = create_model() | |
model.summary() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment