CN( train, test )
function [ thisauc ] = CN( train, test )
%% 計(jì)算CN指標(biāo)并返回AUC值
? ? sim = train * train;?
? ? % 相似度矩陣的計(jì)算
? ? thisauc = CalcAUC(train,test,sim, 10000);?
? ? % 評(píng)測(cè)疮绷,計(jì)算該指標(biāo)對(duì)應(yīng)的AUC抠蚣,獨(dú)立比較10000次
end
Salton( train, test )
以【1,2】這條邊為測(cè)試邊
function [ thisauc ] = Salton( train, test )
%% 計(jì)算Salton指標(biāo)并返回AUC值
? ? tempdeg = repmat((sum(train,2)).^0.5,[1,size(train,1)]);
【sum(X,2)計(jì)算行和?】
%sum(X,2)計(jì)算行和,repmet在行上擴(kuò)展1倍概说,列上擴(kuò)展size(train,1)倍
? ? % 可能溢出,規(guī)模大的話(huà)需要分塊震缭。
? ? tempdeg = tempdeg .* tempdeg';?
? ? % 分母的計(jì)算
? ? sim = train * train;? ? ? ? ? ? ?
? ? % 分子的計(jì)算【共同鄰居數(shù)】
? ? sim = sim./tempdeg;? ? ? ? ? ? ? ?
? ? % 相似度矩陣計(jì)算完成
? ? sim(isnan(sim)) = 0; sim(isinf(sim)) = 0;
%【把矩陣中的NaN和無(wú)窮大置0】
? ? thisauc = CalcAUC(train,test,sim, 10000);? ? ?
? ? % 評(píng)測(cè)垫竞,計(jì)算該指標(biāo)對(duì)應(yīng)的AUC
end