📄 c_confidence_snn.m
字号:
function c_point_conf = c_confidence_snn(elevel, nets, data, alpha)%C_CONFIDENCE_SNN Estimate c_confidence%% Syntax%% c_point_conf = c_confidence_snn(e_level, nets, wcf_data, alpha)%% Description%% C_CONFIDENCE_SNN takes% e_level - error level.% nets - [1 x M] net_structs of trained networks with cost % function WCF_SNN.% wcf_data - wcfdata_struct with training data.% alpha - [1 x M] matrix of network weighting factors.% and returns % c_point_conf - c_confidence.% % (M = #networks in ensemble)%% See also%% CONFIDENCE_SNN, BALANCE_SNN%M = size(nets,2);N = size(nets(1).biases{nets(1).numLayers},1);[NI, MU] = size(data.P);g = getg_snn(nets(1), data);errf = nets(1).costFcn.fn;if nofieldorempty_snn(data, 'useT') data.useT = ones(N, MU);endfor m = 1:M ym(:,:,m) = simff_snn(nets(1,m), data);endy_av = average_outputs_snn(ym, alpha, errf);useTm = reshape(repmat(data.useT,1,M), [N,MU,M]);mu_indices = cell(N,1);for i = 1:N mu = i:N:(N*MU*M); mu_indices{i,1} = mu(find(useTm(mu)));endiall = col(find(useTm));%#function se_snn%#function relerr_snn%#function loglikelihood_snn %#function crosslogistic_snn%#function crossentropy_snnem = zeros(N, MU, M);if isstr(errf) em(iall) = feval(errf, col(ym(iall)), col(repmat(y_av(find(data.useT)),1,M)) ); elseif iscell(errf) for i = 1:N mu = find(data.useT(i,:)); em(mu_indices{i,1}) = feval(errf{i}, ym(mu_indices{i,1}), ... repmat(y_av(i,mu),1,M) ); endelse error('Incorrect format for output errorfunction');endcorrection = 1/(1-sumsqr_snn(alpha));em = correction * em;e_av = reshape(reshape(em, [N*MU, M]) * alpha, [N,MU]);for i = 1:N mu = find(data.useT(i,:)); d3 = repmat(alpha, 1, size(mu,2)) .* repmat(g(i,mu), M, 1); d3 = d3(:)./sum(d3(:)); [d1, d2] = sort(-em(mu_indices{i,1})./(repmat(e_av(i, mu),1,M))); c_point_conf(i,1) = -d1(min(find( cumsum(d3(d2))>elevel )));end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function A = col(A)A = reshape(A, prod(size(A)), 1);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -