compute_counts.m

来自「麻省理工学院的人工智能工具箱,很珍贵,希望对大家有用!」· M 代码 · 共 15 行

M
15
字号
function count = compute_counts(data, sz)% COMPUTE_COUNTS Compute the number of times each combination of assignments occurs% count = compute_counts(data, sz)%% data(i,l) is the value of node i in case l (not a cell array!).% sz is a list of the sizes of each node (number of values it can take on).assert(length(sz) == size(data, 1));P = prod(sz);indices = subv2ind(sz, data'); % each row of data' is a case %count = histc(indices, 1:P);count = hist(indices, 1:P);count = myreshape(count, sz);

⌨️ 快捷键说明

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