?? ginitest.m
字號:
function [rateval,znorm] = ginitest(inpvec,gamma);%------------------------------------------------% This function implements the gini normalization% procedure by finding a threshold using the% reverse water-filling procedure.%% inpvec -> Unnormalized inputs.% gamma -> Normalization Factor.% rateval-> Probability vector.% znorm -> threshold factor.%------------------------------------------------[L,M] = size(inpvec);rateval = zeros(1,M);znorm = 0;if gamma > 0, [fthd,ind] = sort(inpvec); target = gamma; zt = 0; curr = M; while zt < target & curr >= 2, zt = sum(fthd(curr:M) - fthd(curr-1)); curr = curr - 1; end; if curr == 1, if zt < target, % Means we have to include the total classes znorm = 1/M*(sum(fthd(curr:M)) - target); for class = curr:M, rateval(ind(class)) = ((inpvec(ind(class)) - znorm)); end; else znorm = 1/(M-1)*(sum(fthd(2:M)) - target); for class = curr+1:M, rateval(ind(class)) = ((inpvec(ind(class)) - znorm)); end; end; else znorm = 1/(M-curr)*(sum(fthd(curr+1:M)) - target); for class = curr+1:M, rateval(ind(class)) = ((inpvec(ind(class)) - znorm)); end; end;end;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -