Hello
I tried creating the following model
from keras.models import Sequential
from keras.layers.embeddings import Embedding
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.layers.core import Dense, Flatten, Reshape
CNN_filters = 2
CNN_rows = 3
D = embeddings.shape[-1]
cols = D
maxlen = 100
model = Sequential()
model.add(Embedding(input_dim = V.shape[0], output_dim=D, weights=[embeddings], trainable=False, input_length = 100))
model.layers[-1].output_shape
model.add(Reshape(1, 100, D))
model.add(Convolution2D( CNN_filters, CNN_rows, cols, dim_ordering='th', activation='sigmoid' ))
sh = model.layers[-1].output_shape
model.add(MaxPooling2D(pool_size=(sh[-2], sh[-1]),dim_ordering = 'th'))
model.add(Flatten())
model.add(Dense(Dense_size, activation='sigmoid'))
model.add(Dense(out_dim, activation='linear'))
model.compile(loss='rmse', optimizer='sgd')
But then i got the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __init__() takes exactly 2 arguments (4 given)
It was created based on a comment of mr. Chollet on Issue #233
Found it
Wanted another parenthesis
model.add(Reshape( (1, 100, D) ))
Most helpful comment
Found it
Wanted another parenthesis
model.add(Reshape( (1, 100, D) ))