集成分类器matlab


使用matlab训练集成分类器,这里使用的是BP网络,也可以很方便地改为其他分类器,与单个BP分类器相比,正确率由87%上升到97.9,有明显地提高。
资源截图
代码片段和文件信息
function [L hits] = AdaBoost_te(adaboost_modelte_func_handletest_settrue_labels)

hypothesis_n = length(adaboost_model.weights);   % 集成分类器中分类器的个数

sample_n = size(test_set2);   % 样本数

class_n = size(true_labels1);  % class_n = length(unique(true_labels));
temp_L = zeros(class_nsample_nhypothesis_n);   % likelihoods for each weak classifier  
  
% for each weak classifier likelihoods of test samples are collected  
for i=1:hypothesis_n  

% temp_L : 分类结果, hits: 正确率, error_rate: 错误率(与样本权重有关,不过这里样本权重均为1,ones(sample_n1))
    [temp_L(::i) hits error_rate] = te_func_handle(adaboost_model.parameters{i}test_setones(sample_n1)true_labels);  
    
    % 把每一个分类器的 分类结果 * 分类器的权重 最后把各个分类器的结果相加,得到最终的分类结果
    temp_L(::i) = temp_L(::i)*adaboost_model.weights(i);  

end  

L = sum(temp_L3);   % 最终的分类结果为 L

hits = sum(vec2ind(L) == vec2ind(true_labels)); % 集成分类器正确分类的个数。

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-07-27 21:41  集成分类器Adaboost
     文件        1134  2018-04-15 19:50  集成分类器AdaboostAdaBoost_te.m
     文件        1718  2018-04-15 19:38  集成分类器AdaboostAdaBoost_tr.m
     文件    14322325  2018-01-23 23:17  集成分类器AdaboostBatch.mat
     文件        2105  2018-07-27 21:03  集成分类器AdaboostBP.m
     文件        4678  2018-04-15 19:50  集成分类器AdaboostChairman_Ensemble.m
     文件        1574  2018-07-27 21:39  集成分类器AdaboostMain.m
     文件         567  2018-04-15 19:50  集成分类器AdaboostThreshold_te.m
     文件         955  2018-04-15 19:21  集成分类器AdaboostThreshold_tr.m
     文件      941794  2018-07-27 20:04  集成分类器Adaboost传感器数据库汇总.docx
     文件         185  2018-07-27 21:48  集成分类器Adaboost说明.txt

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)