看过这篇博客的都应该明白,特征选择代码实现应该包括3个部分:
搜索算法;
评估函数;
数据;
因此,代码的一般形式为:
AttributeSelection attsel = new AttributeSelection(); // create and initiate a new AttributeSelection instanceRanker search = new Ranker(); // choose a search methodPrincipalComponents eval = new PrincipalComponents(); // choose an evaluation methodattsel.setEvaluator(eval); // set evaluation methodattsel.setSearch(search); // set search methodattsel.SelectAttributes(data); // set the data to be used for attribute selection
其中,搜索方法和评估函数是不同的:
属性评估方法:
CfsSubsetEval:根据属性子集中每一个特征的预测能力以及它们之间的关联性进行评估。
GainRatioAttributeEval:根据与分类有关的每一个属性的增益比进行评估。
InfoGainAttributeEval:根据与分类有关的每一个属性的信息增益进行评估。
ChiSquaredAttributeEval:根据与分类有关的每一个属性的卡方值进行评估。
SymmetricalUncertAtrributeEval:根据与分类有关的每