Das Eingangselement besteht aus 3 Reihen mit jeweils 199 Spalten und der Ausgang hat 46 Zeilen und 1 SpalteKeras Mehr Abmessungen eingegeben simpleRNN: dimension Mismatch
Input.shape, output.shape
((204563, 3, 199), (204563, 46, 1))
Wenn die Eingabe die folgenden Fehler gegeben wird ausgelöst wird:
from keras.layers import Dense
from keras.models import Sequential
from keras.layers.recurrent import SimpleRNN
model = Sequential()
model.add(SimpleRNN(100, input_shape = (Input.shape[1], Input.shape[2])))
model.add(Dense(output.shape[1], activation = 'softmax'))
model.compile(loss = 'categorical_crossentropy', optimizer = 'adam', metrics = ['accuracy'])
model.fit(Input, output, epochs = 20, batch_size = 200)
Fehler ausgelöst:
Epoch 1/20
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-134-378dd431cf45> in <module>()
3 model.add(Dense(y_target.shape[1], activation = 'softmax'))
4 model.compile(loss = 'categorical_crossentropy', optimizer = 'adam', metrics = ['accuracy'])
----> 5 model.fit(X_input, y_target, epochs = 20, batch_size = 200)
.
.
.
ValueError: Error when checking model target: expected dense_6 to have 2 dimensions, but got array with shape (204563, 46, 1)
Bitte legen Sie den Grund für das Problem und mögliche soution