为什么我的自动编码器不提供减少的表示?
Why my autoencoder doesn't give the reduced representation?
我正在尝试创建我的数据的简化表示,我将在另一个模型中使用它,我按以下方式进行:
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
我想我在获取减少的输入的方式中有一个错误,但我看不出确切的位置。如果你能帮我发现它,请!
如果你想要第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])
我正在尝试创建我的数据的简化表示,我将在另一个模型中使用它,我按以下方式进行:
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
我想我在获取减少的输入的方式中有一个错误,但我看不出确切的位置。如果你能帮我发现它,请!
如果你想要第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])