我想使用AdaBoost从大量(〜100k)中选择一个好的设置功能。 AdaBoost通过迭代功能集来添加功能,并根据预成型效果添加功能。它选择对现有功能集错误分类的样本进行预处理的功能。如何使用AdaBoost进行功能选择?
我目前正在使用Open CV的CvBoost
。我得到了一个example working,但从documentation不清楚如何提取它使用的特征索引。
使用CvBoost
(第三方库或自己实现),如何使用AdaBoot从大型功能集中提取一组功能?
我想使用AdaBoost从大量(〜100k)中选择一个好的设置功能。 AdaBoost通过迭代功能集来添加功能,并根据预成型效果添加功能。它选择对现有功能集错误分类的样本进行预处理的功能。如何使用AdaBoost进行功能选择?
我目前正在使用Open CV的CvBoost
。我得到了一个example working,但从documentation不清楚如何提取它使用的特征索引。
使用CvBoost
(第三方库或自己实现),如何使用AdaBoot从大型功能集中提取一组功能?
索赔:我不是opencv的用户。从文档中,opencv的adaboost使用decision tree(分类树或回归树)作为基本的弱学习者。
在我看来,这是通向get the underline weak learners:
CvBoost::get_weak_predictors
Returns the sequence of weak tree classifiers.
C++: CvSeq* CvBoost::get_weak_predictors()
The method returns the sequence of weak classifiers.
Each element of the sequence is a pointer to the CvBoostTree class or
to some of its derivatives.
一旦你有机会获得的CvBoostTree*
序列,你应该能够检查其功能包含在树上,什么是分裂值等。
如果每棵树只是一个决策树,每个弱学习者只包含一个特征。但是如果我们允许更深入的树,每个单独的弱学习者都可能存在特征的组合。
我进一步看了一下CvBoostTree
class;不幸的是,该类本身不提供公共方法来检查所使用的内部特征。但是你可能想创建自己的继承自CvBoostTree
的子类,并公开任何功能。
随着@greeness答案的帮助下,我做的CvBoost
std::vector<int> RSCvBoost::getFeatureIndexes() {
CvSeqReader reader;
cvStartReadSeq(weak, &reader);
cvSetSeqReaderPos(&reader, 0);
std::vector<int> featureIndexes;
int weak_count = weak->total;
for(int i = 0; i < weak_count; i++) {
CvBoostTree* wtree;
CV_READ_SEQ_ELEM(wtree, reader);
const CvDTreeNode* node = wtree->get_root();
CvDTreeSplit* split = node->split;
const int index = split->condensed_idx;
// Only add features that are not already added
if (std::find(featureIndexes.begin(),
featureIndexes.end(),
index) == featureIndexes.end()) {
featureIndexes.push_back(index);
}
}
return featureIndexes;
}
一个子类,这似乎是题外话有以下几个原因:没有明确的问题,对于第三方库,自以为是,和广泛的请求。 – JBentley 2014-09-21 18:26:31
@JBentley - 感谢您的评论。我认为问题很清楚 - 我如何让AdaBoost为特征选择工作。问题的实质是真的表明我在这方面做了一些小腿工作。我不想要第三方图书馆的建议,但是如果解决方案是使用第三方库,那就太好了。我很乐意就如何改善这个问题提出建议,因为我真的想得到一些有用的答复。 – Robert 2014-09-21 18:37:15