Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add primitive for Sequence classification with 1D convolutions #151

Open
Hector-hedb12 opened this issue Apr 4, 2019 · 0 comments
Open
Assignees
Labels
approved The issue is approved and someone can start working on it new primitives A new primitive is being requested

Comments

@Hector-hedb12
Copy link
Contributor

Related to #121

The architecture would be:

Conv1D (relu) ---> Conv1D (relu) --> MaxPooling1D --> 
  Conv1D (relu) ---> Conv1D (relu) --> GlobalAveragePooling1D --> Dropout -->
    Dense (sigmoid)

You can find an example of this here in the Sequence classification with 1D convolutions section:

from keras.models import Sequential
from keras.layers import Dense, Dropout
from keras.layers import Embedding
from keras.layers import Conv1D, GlobalAveragePooling1D, MaxPooling1D

seq_length = 64

model = Sequential()
model.add(Conv1D(64, 3, activation='relu', input_shape=(seq_length, 100)))
model.add(Conv1D(64, 3, activation='relu'))
model.add(MaxPooling1D(3))
model.add(Conv1D(128, 3, activation='relu'))
model.add(Conv1D(128, 3, activation='relu'))
model.add(GlobalAveragePooling1D())
model.add(Dropout(0.5))
model.add(Dense(1, activation='sigmoid'))

model.compile(loss='binary_crossentropy',
              optimizer='rmsprop',
              metrics=['accuracy'])

model.fit(x_train, y_train, batch_size=16, epochs=10)
score = model.evaluate(x_test, y_test, batch_size=16)
@csala csala added approved The issue is approved and someone can start working on it new primitives A new primitive is being requested labels Apr 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved The issue is approved and someone can start working on it new primitives A new primitive is being requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants