• 大小: 692KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-08
  • 语言: Matlab
  • 标签: matlab  svmplsda  

资源简介

使用matlab 开发的分类工具箱,包含svm,plsda ,knn,simca ,lda等,可以直接使用,方便简洁。源代码完整,不容错过。

资源截图

代码片段和文件信息

function class_param = calc_class_param(class_calcclass)

% calc_class_param calculates classification parameters:
% error rate non-error rate specificity precision and sensitivity
%
% class_param = calc_class_param(class_calcclass);
%
% input:
% class           class vector [samples x 1]
% class_calc      calculated class vector [1 x n]

% output:
% class_param     structure containing confusion matrix error rate non-error rate 
%                 accuracy specificity precision and sensitivity
%
% The main routine is class_gui
%
% Note that a detailed HTML help is provided with the toolbox.
% See the HTML HELP files (help.htm) for futher details and examples
%
% Classification toolbox for MATLAB
% version 4.0 - October 2015
% Davide Ballabioabout
% Milano Chemometrics and QSAR Research Group
% http://michem.disat.unimib.it/chm/

num_class = max([max(class) max(class_calc)]);
nobj = size(class1);

conf_mat = zeros(num_classnum_class+1);
for g = 1:num_class
    in_class = find(class==g);
    for k = 1:num_class
        conf_mat(gk) = length(find(class_calc(in_class) == k));
    end
    conf_mat(gnum_class + 1) = length(find(class_calc(in_class) == 0));
end

% sensitivity specificity precision class error accuracy
accuracy = 0;
for g = 1:num_class
    if sum(conf_mat(:g)) > 0
        precision(g)   = conf_mat(gg)/sum(conf_mat(:g));
        sensitivity(g) = conf_mat(gg)/sum(conf_mat(g1:num_class));
    else
        precision(g)   = 0;
        sensitivity(g) = 0;
    end
    in = ones(num_class1); in(g) = 0;
    red_mat = conf_mat(find(in)1:num_class);
    specificity(g) = 0;
    for k = 1:size(red_mat2)
        if k ~= g; specificity(g) = specificity(g) + sum(red_mat(:k)); end;
    end
    if sum(sum(red_mat)) > 0
        specificity(g) = specificity(g)/sum(sum(red_mat));
    else
        specificity(g) = 0;
    end
    false_negative_rate(g) = 1 - sensitivity(g);
    false_positive_rate(g) = 1 - specificity(g);
    accuracy = accuracy + conf_mat(gg);
end
accuracy = accuracy/sum(sum(conf_mat(:1:num_class)));

% error rates
not_ass = sum(conf_mat(:end))/nobj;
ner = mean(sensitivity);
er = 1 - ner;

class_param.conf_mat = conf_mat;
class_param.ner = ner;
class_param.er  = er;
class_param.accuracy  = accuracy;
class_param.not_ass = not_ass;
class_param.precision = precision;
class_param.sensitivity = sensitivity;
class_param.specificity = specificity;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-03-21 16:10  classification_toolbox_4.0\classification_toolbox_4.0\
     文件        2495  2015-10-14 14:45  classification_toolbox_4.0\classification_toolbox_4.0\calc_class_param.m
     文件        1083  2015-10-14 14:51  classification_toolbox_4.0\classification_toolbox_4.0\calc_qt_limits.m
     文件         907  2015-10-14 14:51  classification_toolbox_4.0\classification_toolbox_4.0\calc_reg_param.m
     文件        4627  2015-10-14 14:51  classification_toolbox_4.0\classification_toolbox_4.0\cartcv.m
     文件        1632  2015-10-22 15:13  classification_toolbox_4.0\classification_toolbox_4.0\cartfit.m
     文件         743  2015-10-14 14:51  classification_toolbox_4.0\classification_toolbox_4.0\cartpred.m
     文件       31313  2015-10-22 11:18  classification_toolbox_4.0\classification_toolbox_4.0\class_gui.fig
     文件       88652  2015-11-05 13:18  classification_toolbox_4.0\classification_toolbox_4.0\class_gui.m
     文件         192  2016-04-11 19:42  classification_toolbox_4.0\classification_toolbox_4.0\class_text.mat
     文件        2427  2015-10-14 14:51  classification_toolbox_4.0\classification_toolbox_4.0\dacompsel.m
     文件        5710  2015-10-14 14:51  classification_toolbox_4.0\classification_toolbox_4.0\dacv.m
     文件        4290  2015-10-22 15:19  classification_toolbox_4.0\classification_toolbox_4.0\dafit.m
     文件        2865  2015-10-14 14:51  classification_toolbox_4.0\classification_toolbox_4.0\dapred.m
     文件        1678  2015-10-14 14:51  classification_toolbox_4.0\classification_toolbox_4.0\data_pretreatment.m
     文件        1117  2015-10-14 12:06  classification_toolbox_4.0\classification_toolbox_4.0\help.htm
     目录           0  2017-03-21 16:10  classification_toolbox_4.0\classification_toolbox_4.0\help\
     文件        8023  2015-11-05 13:27  classification_toolbox_4.0\classification_toolbox_4.0\help\classparameters.htm
     文件        2136  2015-03-05 17:54  classification_toolbox_4.0\classification_toolbox_4.0\help\download.htm
     文件       12281  2015-10-14 11:11  classification_toolbox_4.0\classification_toolbox_4.0\help\example.htm
     文件        9259  2013-04-04 11:55  classification_toolbox_4.0\classification_toolbox_4.0\help\example_plsda_01.gif
     文件        5246  2013-04-04 11:52  classification_toolbox_4.0\classification_toolbox_4.0\help\example_plsda_02.gif
     文件        3186  2013-04-04 11:54  classification_toolbox_4.0\classification_toolbox_4.0\help\example_plsda_03.gif
     文件        7228  2013-04-04 11:57  classification_toolbox_4.0\classification_toolbox_4.0\help\example_plsda_04.gif
     文件       11294  2013-04-04 11:57  classification_toolbox_4.0\classification_toolbox_4.0\help\example_plsda_05.gif
     文件        5330  2013-04-04 11:58  classification_toolbox_4.0\classification_toolbox_4.0\help\example_plsda_06.gif
     文件        7335  2013-04-04 12:00  classification_toolbox_4.0\classification_toolbox_4.0\help\example_plsda_07.gif
     文件        3165  2013-04-04 12:01  classification_toolbox_4.0\classification_toolbox_4.0\help\example_plsda_08.gif
     文件        4771  2013-04-04 12:01  classification_toolbox_4.0\classification_toolbox_4.0\help\example_plsda_09.gif
     文件        8197  2013-04-04 12:03  classification_toolbox_4.0\classification_toolbox_4.0\help\example_plsda_10.gif
     文件         589  2013-10-02 15:36  classification_toolbox_4.0\classification_toolbox_4.0\help\footer.htm
............此处省略111个文件信息

评论

共有 条评论