シンプルなオートエンコーダーを実行しようとしていますが、すべてのトレーニング入力は同じです。トレーニングデータの特徴は3であり、隠れた層は3つのノードを有する。私はその入力でオートエンコーダーを訓練してから、再びエンコード/デコードを試みます(オートエンコーダーが何も変更せずにそのまま渡すと、うまくいきます)Keras autoencoderシンプルな例が異常な出力を持っています
とにかく、私は午前理由を理解するためにちょっとしたことをしています。私のコードで何かが間違っているかどうか、あるいは自動実装の実装を理解しているかどうかはわかりません。これは参考のためのコードです。
P.S.私はエポッシュの数、トレーニングセットの例数、バッチサイズ、トレーニングデータの値を0〜1の間で行い、損失値を追跡しましたが、どちらも役に立ちませんでした。
`
from keras.layers import Input, Dense
from keras.models import Model
import numpy as np
# this is the size of our encoded representations
encoding_dim = 3
x_train=np.array([[1,2,3],[1,2,3],[1,2,3],[1,2,3],[1,2,3],[1,2,3],[1,2,3],[1,2,3],[1,2,3]])
in= Input(shape=(3,))
encoded = Dense(encoding_dim, activation='relu')(in)
decoded = Dense(3, activation='sigmoid')(encoded)
# this model maps an input to its reconstruction
autoencoder = Model(in, decoded)
autoencoder.compile(optimizer='adadelta', loss='mse')
autoencoder.fit(x_train, x_train,
epochs=100,
batch_size=4)
autoencoder.predict(x_train)
`
私が手出力は、入力(または少なくとも近い)と同じである必要がありますが、私が代わりにこれを取得)
`Out[180]:
array([[ 0.80265796, 0.89038897, 0.9100889 ],
[ 0.80265796, 0.89038897, 0.9100889 ],
[ 0.80265796, 0.89038897, 0.9100889 ],
...,
[ 0.80265796, 0.89038897, 0.9100889 ],
[ 0.80265796, 0.89038897, 0.9100889 ],
[ 0.80265796, 0.89038897, 0.9100889 ]], dtype=float32)`
どれでも役立つだろう私は間違ったことを理解している可能性が高いので、この質問はそれほど難しい答えではありません。