我在项目中实现了Adaboost,但我不确定是否正确理解了Adaboost。这是我的实现过程,请告诉我是否正确。
- 我的弱分类器是8个不同的神经网络。每个分类器在完全训练后的准确率约为70%。
- 我对所有这些网络进行完全训练,并收集它们在训练集上的预测结果;因此,我有8个训练集预测向量。
现在我使用Adaboost。我对Adaboost的理解是它会将我训练出的8个分类器加权平均得到一个最终的分类器,而它的作用是找到这些权重。因此,对于每个训练示例,我有8个预测值,并且使用Adaboost权重将它们组合起来。请注意,根据这种解释,弱分类器在Adaboost迭代期间不会重新训练,只有权重会更新。但是,更新后的权重实际上在每次迭代中创建了新的分类器。
以下是伪代码:
all_alphas = []
all_classifier_indices = []
initialize all training example weights to 1/(num of examples)
compute error for all 8 networks on the training set
for i in 1 to T:
find the classifier with lowest weighted error.
compute the weights (alpha) according to the Adaboost confidence formula
Update the weight distribution, according to the weight update formula in Adaboost.
all_alphas.append(alpha)
all_classifier_indices.append(selected_classifier)
经过 T
次迭代,会有 T
个 alpha 值和 T
个分类器索引;这 T
个分类器索引将指向 8 个神经网络预测向量之一。
然后在测试集上,对于每个示例,通过对 alpha*classifier
进行求和进行预测。
我想使用 AdaBoost 算法与神经网络结合,但我认为我可能误解了 AdaBoost 算法的含义。