Created
March 26, 2020 21:19
-
-
Save aravindpai/ba51f9ea6c6da29dd8b69db59df6bf10 to your computer and use it in GitHub Desktop.
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
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