注意点:MLKNN_train注释部分有train_target - A QxM array, if the ith training instance belongs to the jth class, then train_target(j,i) equals +1, otherwise train_target(j,i) equals -1  。如果设置成1和0可以吗?不行,因为MLKNN_test有如下代码:
for i=1:num_testing
        for j=1:num_class
            if(Outputs(j,i)>=0.5)
                Pre_Labels(j,i)=1;
            else
                Pre_Labels(j,i)=-1;
            end
        end
    end
HammingLoss=Hamming_loss(Pre_Labels,test_target);
再看HammingLoss代码,要比较Pre_Labels和test_target,Pre_Labels是1和-1,如果test_target 是1和0就会出错
MLKNN_test程序中最后几句    HammingLoss=Hamming_loss(Pre_Labels,test_target);    RankingLoss=Ranking_loss(Outputs,test_target);OneError=One_error(Outputs,test_target);
    Coverage=coverage(Outputs,test_target);Average_Precision=Average_precision(Outputs,test_target);HammingLoss是基于输出标号和实际标号,其余均是基于输出概率和实际标号

Understand completely the meaning and matlab code of  HammingLoss, the matlab code is very simple.