2016-11-19 127 views
0

我有一个数据集MNIST手写数字与257列。使用Keras降低尺寸

1 : 256 - pixel values 
257 - target 

如何设计一个使用keras的自动编码器来减少使用2维的输入。

我已经试过

encoding_dim = 32 
input_img = Input(shape=(256,)) 
encoded = Dense(encoding_dim, activation='relu')(input_img) 
decoded = Dense(256, activation='sigmoid')(encoded) 

# this model maps an input to its reconstruction 
autoencoder = Model(input=input_img, output=decoded) 
autoencoder.compile(optimizer='adadelta', loss='binary_crossentropy') 
autoencoder.fit(X, X, 
      nb_epoch=50, 
      batch_size=256, 
      shuffle=True) 

错误

KeyError: '[318 327 ...] not in index 

回答

0

我可以使用,而不是熊猫据帧numpy的阵列解决这个问题。