📄 relabel_samples.m~
字号:
function [bestMapping, errorProbability] = relabel_samples(aprioriSampleLabels, computedSampleLabels, subspaceDimensions)%function [bestMapping, errorProbability, groupError] = relabel_samples(aprioriSampleLabels, computedSampleLabels, subspaceDimensions)%% Attempts to find a good mapping between two sets of sample labels based on their% grouping alone. A valid permutation vector will be returned in all cases.% % The function is restricted to only permute subspaces of equal dimensions.groupCount = length(subspaceDimensions);computedSampleFrequencies = histc(computedSampleLabels, 1:groupCount);sampleCount = length(aprioriSampleLabels);errorProbability = 1;newSampleLabels = zeros(1,sampleCount);% Generate all legal permutations. No cross permutation of different% dimensionsfor dimensionIndex=1:ambientDimension-1 allPermutations = perms(1:groupCount);endembedded = groupCount*(computedSampleLabels - 1) + (aprioriSampleLabels - 1);histogram = histc(embedded, 0:groupCount^2 - 1);for permutationIndex = 1 : size(allPermutations, 1) correct = 0; mapping = allPermutations(permutationIndex, :); correct = sum(histogram(groupCount*(0:groupCount-1) + mapping)) / sampleCount; if (correct > 1 - errorProbability) errorProbability = 1 - correct; bestMapping = mapping; endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -