Skip to content

Instantly share code, notes, and snippets.

@shubham0204
Last active June 13, 2019 05:21
Show Gist options
  • Save shubham0204/a0578276236c7428f9698abf3cc6e1d8 to your computer and use it in GitHub Desktop.
Save shubham0204/a0578276236c7428f9698abf3cc6e1d8 to your computer and use it in GitHub Desktop.
model_layers = [
tf.keras.layers.Embedding( vocab_len + 1 , output_dim=50 , input_length=input_length ) ,
tf.keras.layers.Conv1D( 32 , kernel_size=5 , activation="relu",strides=1 , input_shape=( input_length , 50 )),
tf.keras.layers.Conv1D( 64, kernel_size=5, activation="relu", strides=1),
tf.keras.layers.MaxPool1D( pool_size=4 , strides=1 ),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense( 256 , activation="relu" ),
tf.keras.layers.Dropout( 0.5 ) ,
tf.keras.layers.Dense(2, activation="softmax" )
]
model = tf.keras.Sequential( model_layers )
model.compile( loss=tf.keras.losses.categorical_crossentropy ,
optimizer=tf.keras.optimizers.Adam( lr=0.0001 ) ,
metrics=[ 'accuracy' ]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment