I'm going to train my network using a keras tensorflow convolutional neural network, this is my code, I have a mistake in compiling the function, but I don’t know why
model = Sequential()
model.add(Embedding(input_dim = n_symbols + 1,
output_dim = vocab_dim,
input_length=maxlen,
dropout=0.2))
model.add(Convolution1D(nb_filter=nb_filter,
filter_length=filter_length,
border_mode='valid',
activation='relu',
subsample_length=1))
model.add(GlobalMaxPooling1D())
model.add(Dense(hidden_dims))
model.add(Dropout(0.2))
model.add(Activation('relu'))
model.add(Dense(1))
model.add(Activation('sigmoid'))
model.compile(loss='mean_squared_error',
optimizer='adam',
metrics=['accuracy'])
model.fit(X_train, y_train,
batch_size=batch_size,
nb_epoch=nb_epoch,
validation_data=(X_test, y_test))
print("Evaluate...")
score, acc = model.evaluate(X_test, y_test,
batch_size=batch_size)
print('Test score:', score)
print('Test accuracy:', acc)
error:
ValueError: Operation u'init_27' has been marked as not fetchable.
source
share