⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intersection_reclassification.m

📁 一个用EM算法的源程序
💻 M
字号:
function sampleLabels = intersection_reclassification(X, sampleLabels,subspaceNumber);% Set constant valuesK_NEAREST_NEIGHBOR = 1;[ambientDimension, sampleNumber]=size(X);method = K_NEAREST_NEIGHBOR;if method == K_NEAREST_NEIGHBOR    KConstant = 5;        % Create distance matrix    distanceMatrix = zeros(sampleNumber, sampleNumber);    for sampleIndex=1:sampleNumber        for index=sampleIndex+1:sampleNumber            distanceMatrix(sampleIndex,index)=norm(X(:,sampleIndex)-X(:,index));        end        % Assign an artifial value for the sample itself so that it will        % never be its own neighbor.        distanceMatrix(sampleIndex, sampleIndex)=inf;    end    distanceMatrix = distanceMatrix + distanceMatrix.';        % For each sample, find the nearest KConstant neighbors    for sampleIndex=1:sampleNumber        [ignored, index]= sort(distanceMatrix(:,sampleIndex));        neighborLabels=sampleLabels(index(1:KConstant));        for subspaceIndex=1:subspaceNumber            neighborWeight = sum(neighborLabels==subspaceIndex);            if neighborWeight>KConstant/2                sampleLabels(sampleIndex)=subspaceIndex;                break;            end        end            endend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -