2017-07-14 7 views
1

私は、以下のようなレイヤーでKerasに畳み込みオートエンコーダーを実装しようとしています。私のデータは1108行と29430列です。埋め込みレイヤのためのKeras - 入力シェイプ

ただし、ValueError: Error when checking input: expected embedding_1_input to have shape (None, 11900) but got array with shape (1108, 29430)というエラーが表示されます。最初のレイヤーがデータのサイズではなく、(None、maxlen)を期待するのはなぜですか?

私も自分のモデルの要約が含まれます:

_________________________________________________________________ 
Layer (type)     Output Shape    Param # 
================================================================= 
embedding_1 (Embedding)  (None, 11900, 60)   714000  
_________________________________________________________________ 
dropout_1 (Dropout)   (None, 11900, 60)   0   
_________________________________________________________________ 
conv1d_1 (Conv1D)   (None, 11898, 70)   12670  
_________________________________________________________________ 
max_pooling1d_1 (MaxPooling1 (None, 5949, 70)   0   
_________________________________________________________________ 
conv1d_2 (Conv1D)   (None, 5947, 70)   14770  
_________________________________________________________________ 
up_sampling1d_1 (UpSampling1 (None, 11894, 70)   0   
================================================================= 
Total params: 741,440 
Trainable params: 741,440 
Non-trainable params: 0 
_________________________________________________________________ 

答えて

1

Iは次のように埋め込み層にinput_shapeフィールドを追加することによって、この特定のエラーを修正:

m.add(Embedding(features, embedding_dims, input_length=maxlen, input_shape=(features,))) 

featuresフィーチャ(29430)の数です。

0

あなたはこの形式にデータを再構築する必要がありますので、埋め込み層へのご入力は(N)、次元のいずれかでなければなりません。あなたがinput_lengthに渡したものは、nサイズに一致する必要があります。

関連する問題