簡體   English   中英

Python Keras 順序 model 輸入

[英]Python Keras Sequential model input

我有一個數組用於嘗試使用tf.Keras 進行機器學習預測的一些時間序列滑動 window 方法

X.shape

(8779, 6, 1)

安裝 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')

誰能給我一個關於如何糾正這個 model 輸入的提示?

input_shape=(6,)

我不知道如何克服這個錯誤:

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)

盡管它是通過評論的建議解決的,但這里是解決方案:

改變:

input_shape=(6,)

進入:

input_shape=(6,1)

工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM