资源简介
该代码专门处理多标记数据,使用扩展的最近邻算法建立能够处理多标记数据集的分类器,而且提供几种有效的评价指标。

代码片段和文件信息
function Average_Precision=Average_precision(Outputstest_target)
%Computing the average precision
%Outputs: the predicted outputs of the classifier the output of the ith instance for the jth class is stored in Outputs(ji)
%test_target: the actual labels of the test instances if the ith instance belong to the jth class test_target(ji)=1 otherwise test_target(ji)=-1
[num_classnum_instance]=size(Outputs);
temp_Outputs=[];
temp_test_target=[];
for i=1:num_instance
temp=test_target(:i);
if((sum(temp)~=num_class)&(sum(temp)~=-num_class))
temp_Outputs=[temp_OutputsOutputs(:i)];
temp_test_target=[temp_test_targettemp];
end
end
Outputs=temp_Outputs;
test_target=temp_test_target;
[num_classnum_instance]=size(Outputs);
Label=cell(num_instance1);
not_Label=cell(num_instance1);
Label_size=zeros(1num_instance);
for i=1:num_instance
temp=test_target(:i);
Label_size(1i)=sum(temp==ones(num_class1));
for j=1:num_class
if(temp(j)==1)
Label{i1}=[Label{i1}j];
else
not_Label{i1}=[not_Label{i1}j];
end
end
end
aveprec=0;
for i=1:num_instance
temp=Outputs(:i);
[tempvalueindex]=sort(temp);
indicator=zeros(1num_class);
for m=1:Label_size(i)
[tempvalueloc]=ismember(Label{i1}(m)index);
indicator(1loc)=1;
end
summary=0;
for m=1:Label_size(i)
[tempvalueloc]=ismember(Label{i1}(m)index);
summary=summary+sum(indicator(loc:num_class))/(num_class-loc+1);
end
ap_binary(i)=summary/Label_size(i);
aveprec=aveprec+summary/Label_size(i);
end
Average_Precision=aveprec/num_instance;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1910 2005-04-21 16:43 Average_precision.m
文件 1334 2005-01-23 22:10 coverage.m
文件 539 2005-01-23 21:39 Hamming_loss.m
文件 4763 2005-06-08 10:44 MLKNN_test.m
文件 3685 2005-06-08 10:44 MLKNN_train.m
文件 1727 2005-05-31 14:52 One_error.m
文件 1681 2005-04-21 16:43 Ranking_loss.m
----------- --------- ---------- ----- ----
15639 7
相关资源
- 用各种机器学习方法knn,随机森林,
- KNN-文本聚类
- 人车分类识别 HOG特征+KNN分类器
- knn文本聚类小型数据集
- 决策树算法原理详解
- 机器学习实战之K邻近算法
- 文本分类器,KNNSVM贝叶斯等都有
- R语言分类(SVM KNN LDA等)与回归代码
- KNN算法与Tensorflow分别实现的手写识别
- 一种基于层次分析法的改进KNN算法
- 最邻近算法KNN识别字符
- opencv 的knn的训练数据
- stm32单片机knn算法手写数字识别
- BOWBag of words,词袋模型代码实现
- 数码管数别字识--KNN算法
- KNN疾病预测算法Demo
- PCA+KNN人脸表情识别
- KNN实现手写数字识别
- datingTestSet2数据集
- 用于knn分类的CIFAR-10数据集
- KNN算法实现手写数字识别的三种方法
- 手写体数字识别系统实现
- minst数据集机器学习练习
- 用KNN算法诊断乳腺癌
- KNN算法诊断乳腺癌
- KNN实现代码+数据可视化+决策边界
- knn手写数字识别training及test数据集
- Knn测试数据
- KNN算法预测鸢尾花的种类,源码以及
- kNN分类算法数据集
评论
共有 条评论