【问题标题】:Why my autoencoder doesn't give the reduced representation?为什么我的自动编码器没有给出简化的表示?
【发布时间】:2017-11-20 18:28:59
【问题描述】:

我正在尝试创建我的数据的简化表示,我将在另一个模型中使用它,并且我按照以下方式进行:

   input = Input(shape=(70,))
   encoded = Dense(output_dim=10, input_dim=70, activation='relu')(input)
   decoded = Dense(70, activation='relu')(encoded)
   autoencoder = Model(input, decoded)
   autoencoder.compile(optimizer='adam', loss='binary_crossentropy')
   autoencoder.fit(df_values, df_values,epochs=10,batch_size=32)
   reduced_input = autoencoder.predict(df_values)

但是reduced_input 中仍然有 100 列,它们已经修改了值,即与初始 input 中的值不同,但仍然没有像我预期的那样减少表示(如 PCA 的组件),即使我指定了output_dim=10

我想我在获取减少输入的方式中存在错误,但我不知道具体在哪里。如果你能帮我发现它,请!

【问题讨论】:

  • 当您对问题投反对票时,请说明问题所在

标签: python deep-learning keras pca autoencoder


【解决方案1】:

如果你想要第 7 层,那么:

output_func_Layer_7 = K.function([autoencoder.layers[0].input, K.learning_phase()],
                     [autoencoder.layers[7].output])
intermediate_output = output_func_Layer_7([X_train, False])

【讨论】:

  • 这只是一个例子。在您的情况下,您需要隔离第一层: output_func_Layer_1 = K.function([autoencoder.layers[0].input, 'K.learning_phase()], [autoencoder.layers[1].output]) intermediate_output = output_func_Layer_1([ X_train, False])' 然后你画它。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-02-25
  • 1970-01-01
  • 2020-11-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-06
相关资源
最近更新 更多