Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def create_model():
- embedding_layer = Embedding(input_dim=100, output_dim=300,
- input_length=100)
- model = Sequential()
- model.add(embedding_layer)
- model.add(Dropout(0.2))
- model.add(Conv1D(filters=100, kernel_size=4, padding='same', activation='relu'))
- model.add(MaxPooling1D(pool_size=4))
- model.add(LSTM(units=100, return_sequences=True))
- model.add(GlobalMaxPooling1D())
- model.add(Dense(1, activation='sigmoid'))
- ###### multiclassification #########
- #model.add(Dense(3, activation='softmax')) #I want to replace the above line with this for multi-classification but this didnt work
- model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
- Programs/anaconda3/lib/python3.6/site-packages/keras/engine/training.py in _standardize_input_data(data=array([1, 1, 2, 1, 0, 0, 2, 1, 1, 2, 0, 0, 1, 1,...2, 0, 2, 1, 0, 2, 0, 1, 0, 0,
- 1, 2, 2, 0]), names=['dense_1'], shapes=[(None, 3)], check_batch_axis=False, exception_prefix='model target')
- 128 raise ValueError(
- 129 'Error when checking ' + exception_prefix +
- 130 ': expected ' + names[i] +
- 131 ' to have shape ' + str(shapes[i]) +
- 132 ' but got array with shape ' +
- --> 133 str(array.shape))
- array.shape = (280, 1)
- 134 return arrays
- 135
- 136
- 137 def _standardize_sample_or_class_weights(x_weight, output_names, weight_type):
- ValueError: Error when checking model target: expected dense_1 to have shape (None, 3) but got array with shape (280, 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement