Guest User

Untitled

a guest
May 25th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. # For a single-input model with 2 classes (binary classification):
  2. model = Sequential()
  3. model.add(Dense(32, activation='relu', input_dim=100))
  4. model.add(Dense(1, activation='sigmoid'))
  5.  
  6. model.compile(optimizer='rmsprop', loss='binary_crossentropy',
  7. metrics=['accuracy'])
  8.  
  9. model = Sequential()
  10.  
  11. model.add(LSTM(32, return_sequences=True, stateful=True,
  12. batch_input_shape=(batch_size, timesteps, data_dim)))
  13.  
  14. model.add(LSTM(32, return_sequences=True, stateful=True))
  15. model.add(LSTM(32, stateful=True))
  16. model.add(Dense(10, activation='softmax'))
  17.  
  18. model.compile(loss='categorical_crossentropy',
  19. optimizer='rmsprop',
  20. metrics=['accuracy'])
  21.  
  22. model = Sequential()
  23. model.add(Conv1D(64, 3, activation='relu', input_shape=(seq_length, 100)))
  24. model.add(Conv1D(64, 3, activation='relu'))
  25.  
  26. model.add(MaxPooling1D(3))
  27. model.add(Conv1D(128, 3, activation='relu'))
  28. model.add(Conv1D(128, 3, activation='relu'))
  29. model.add(GlobalAveragePooling1D())
  30.  
  31. model.add(Dropout(0.5))
  32. model.add(Dense(1, activation='sigmoid'))
Add Comment
Please, Sign In to add comment