Created
November 4, 2020 08:29
-
-
Save oscar-defelice/1b6f58bfb7b038ad96c8e440161fc18f 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
| # build the model | |
| keras_model = Sequential() | |
| keras_model.add(Embedding(vocab_size, output_dim = emb_dim, input_length=max_len)) | |
| keras_model.add(Dropout(dropout_rate)) | |
| keras_model.add(Conv1D(50, 3, activation='relu', padding='same', strides=1)) | |
| keras_model.add(MaxPool1D()) | |
| keras_model.add(Dropout(dropout_rate)) | |
| keras_model.add(Conv1D(100, 3, activation='relu', padding='same', strides=1)) | |
| keras_model.add(MaxPool1D()) | |
| keras_model.add(Dropout(dropout_rate)) | |
| keras_model.add(Conv1D(200, 3, activation='relu', padding='same', strides=1)) | |
| keras_model.add(GlobalMaxPool1D()) | |
| keras_model.add(Dropout(dropout_rate)) | |
| keras_model.add(Dense(100)) | |
| keras_model.add(Activation('relu')) | |
| keras_model.add(Dropout(dropout_rate)) | |
| keras_model.add(Dense(n_labels)) | |
| keras_model.add(Activation('softmax')) | |
| keras_model.compile(loss=loss, metrics=[metric], optimizer=opt) | |
| keras_model.summary() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment