我有一个项目,正在使用表格数据对梯度提升树进行回归。我想看看在我的数据上使用去噪自动编码器是否可以更好地表示我的原始数据并提高我的原始 GBT 分数。灵感来自流行的 Kaggle 获胜者 here.
据我所知,我有两个主要选择来提取 DAE 的激活 - 创建瓶颈结构并采用单个中间层激活或连接每个层的激活作为表示。
假设我想要来自下面 3x 512 节点层的所有层激活:
inputs = Input(shape=(31,))
encoded = Dense(512, activation='relu')(inputs)
encoded = Dense(512, activation='relu')(encoded)
decoded = Dense(512, activation='relu')(encoded)
decoded = Dense(31, activation='linear')(decoded)
autoencoder = Model(inputs, decoded)
autoencoder.compile(optimizer='Adam', loss='mse')
history = autoencoder.fit(x_train_noisy, x_train_clean,
epochs=100,
batch_size=128,
shuffle=True,
validation_data=(x_test_noisy, x_test_clean),
callbacks=[reduce_lr])
我的问题是:
采用上述激活将为我提供 x_train 的新表示,对吧?我应该对 x_test 重复这个过程吗?我需要两者来训练我的 GBT 模型。
如何进行推理?每个新数据点都需要“转换”为这种新的表示格式。我如何使用 Keras 做到这一点?
在这种情况下,我真的需要向
.fit
提供validation_data=
吗?
最佳答案
Taking the activations of the above will give me a new representation of x_train, right? Should I repeat this process for x_test? I need both to train my GBT model.
当然,您需要对训练数据和测试数据进行去噪表示,因为您稍后训练的 GBT 模型仅接受去噪特征。
How can I do inference? Each new data point will need to be "converted" into this new representation format. How can I do that with Keras?
如果想使用去噪/重构的特征,可以直接使用autoencoder.predict( X_feat )
来提取特征。如果要使用中间层,需要先构建一个新模型encoder_only=Model(inputs,encoded)
并用它来进行特征提取。
Do I actually need to provide validation_data= to .fit in this situation?
您最好分离一些训练数据进行验证,以防止过度拟合。但是,您始终可以训练多个模型,例如以留一法的方式以集成的方式充分利用所有数据。
补充说明:
- 512 个隐藏神经元对于您的任务来说似乎太多了
- 考虑使用
DropOut
- 要小心表格数据,尤其是当不同列中的数据具有不同的动态范围时(即 MSE 不能公平地量化不同列的重建误差)。
关于machine-learning - Keras 去噪自动编码器(表格数据),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50012105/