简体   繁体   中英

Python Keras Sequential model input

I have an array for attempting some times series sliding window method for machine learning forecasting with tf.Keras:

X.shape

(8779, 6, 1)

to fit the MLP model:

# define model
model = Sequential()
model.add(Dense(100, activation='relu', input_shape=(6,)))
model.add(Dense(1))
model.compile(optimizer='adam', loss='mse')

Could anyone give me a tip on how to correct this model input?

input_shape=(6,)

I cant figure out to how get past this error:

ValueError: Input 0 of layer sequential is incompatible with the layer: expected axis -1 of input shape to have value 6 but received input with shape (None, 6, 1)

Even though it was solved by a recommendation from comments, here is the solution:

Changing:

input_shape=(6,)

Into:

input_shape=(6,1)

worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM