DOsinga / deep_learning_cookbook

Deep Learning Cookbox
Apache License 2.0
689 stars 338 forks source link

07.1 cannot import Merge from keras.layers, regularizers is not defined #24

Closed nicksexton closed 6 years ago

nicksexton commented 6 years ago
  1. from keras.layers import Input, Conv1D, MaxPooling1D, Flatten, Dense, Dropout, LSTM, Merge

causes an error. From this question on stackoverflow, this is due to an update in Keras 2.

  1. I've tried commenting it out, the code in the cell now throws an error dense = Dense(128, activation='relu', kernel_regularizer=regularizers.l2(0.01))(flatten)

as regularizers is not defined. I can't see why these problems are related but thought it worth mentioning. When I comment out both the kernel_regularizer parameter the cell runs and I can get the model to train.