Skip to content

Instantly share code, notes, and snippets.

@aravindpai
Created Mar 26, 2020
Embed
What would you like to do?
from keras.layers import *
from keras.models import *
from keras.callbacks import *
import keras.backend as K
K.clear_session()
model = Sequential()
#embedding layer
model.add(Embedding(len(unique_x), 100, input_length=32,trainable=True))
model.add(Conv1D(64,3, padding='causal',activation='relu'))
model.add(Dropout(0.2))
model.add(MaxPool1D(2))
model.add(Conv1D(128,3,activation='relu',dilation_rate=2,padding='causal'))
model.add(Dropout(0.2))
model.add(MaxPool1D(2))
model.add(Conv1D(256,3,activation='relu',dilation_rate=4,padding='causal'))
model.add(Dropout(0.2))
model.add(MaxPool1D(2))
#model.add(Conv1D(256,5,activation='relu'))
model.add(GlobalMaxPool1D())
model.add(Dense(256, activation='relu'))
model.add(Dense(len(unique_y), activation='softmax'))
model.compile(loss='sparse_categorical_crossentropy', optimizer='adam')
model.summary()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment