guif.m
来自「神经网络的工具箱, 神经网络的工具箱,」· M 代码 · 共 2,017 行 · 第 1/4 页
M
2,017 行
[y, sc] = sc_meanzero_snn(x);else [y, sc(prod(size(sc))+1)] = sc_meanzero_snn(scale_snn(x, sc));endscale{no} = sc;au('scale', scale);au('scaling.next.enable', 'off');graphics_snn('scaling');%==================================================================% SCALING_STDONE %% GUIF('scaling_stdone')%==================================================================elseif strcmp(cmd, 'scaling_stdone')readdata = gu('readdata');no = gu('scaling.pop.value');scale = gu('scale');sc = scale{no};x = readdata(:, no); if (isempty(sc)) [y, sc] = sc_stdone_snn(x);else [y, sc(prod(size(sc))+1)] = sc_stdone_snn(scale_snn(x, sc));endscale{no} = sc;au('scale', scale);au('scaling.next.enable', 'off');graphics_snn('scaling');%==================================================================% SCALING_ZEROONE %% GUIF('scaling_zeroone')%==================================================================elseif strcmp(cmd, 'scaling_zeroone')readdata = gu('readdata');no = gu('scaling.pop.value');scale = gu('scale');sc = scale{no};x = readdata(:, no); if (isempty(sc)) [y, sc] = sc_zeroone_snn(x);else [y, sc(prod(size(sc))+1)] = sc_zeroone_snn(scale_snn(x, sc));endscale{no} = sc;au('scale', scale);au('scaling.next.enable', 'off');graphics_snn('scaling');%==================================================================% SCALING_MONEONE %% GUIF('scaling_moneone')%==================================================================elseif strcmp(cmd, 'scaling_moneone')readdata = gu('readdata');no = gu('scaling.pop.value');scale = gu('scale');sc = scale{no};x = readdata(:, no); if (isempty(sc)) [y, sc] = sc_moneone_snn(x);else [y, sc(prod(size(sc))+1)] = sc_moneone_snn(scale_snn(x, sc));endscale{no} = sc;au('scale', scale);au('scaling.next.enable', 'off');graphics_snn('scaling');%==================================================================% SCALING_INV %% GUIF('scaling_inv')%==================================================================elseif strcmp(cmd, 'scaling_inv')readdata = gu('readdata');no = gu('scaling.pop.value');scale = gu('scale');sc = scale{no};x = readdata(:, no); if (isempty(sc)) if find(x==0) stdout_snn('Error: to scale with inv all data must be <> 0\n'); else [y, sc] = sc_inv_snn(x); scale{no} = sc; au('scale', scale); au('scaling.next.enable', 'off'); endelse x = scale_snn(x, sc); if find(x==0) stdout_snn('Error: to scale with inv all data must be <> 0\n'); else [y, sc(prod(size(sc))+1)] = sc_inv_snn(x); scale{no} = sc; au('scale', scale); au('scaling.next.enable', 'off'); endendgraphics_snn('scaling');%==================================================================% SCALING_SQRT %% GUIF('scaling_sqrt')%==================================================================elseif strcmp(cmd, 'scaling_sqrt')readdata = gu('readdata');no = gu('scaling.pop.value');scale = gu('scale');sc = scale{no};x = readdata(:, no); if (isempty(sc)) if find(x<0) stdout_snn('Error: to scale with sqrt all data must be > 0\n'); else [y, sc] = sc_sqrt_snn(x); scale{no} = sc; au('scale', scale); au('scaling.next.enable', 'off'); endelse x = scale_snn(x, sc); if find(x<0) stdout_snn('Error: to scale with sqrt all data must be > 0\n'); else [y, sc(prod(size(sc))+1)] = sc_sqrt_snn(x); scale{no} = sc; au('scale', scale); au('scaling.next.enable', 'off'); endendgraphics_snn('scaling');%==================================================================% SCALING_LOG %% GUIF('scaling_log')%==================================================================elseif strcmp(cmd, 'scaling_log')readdata = gu('readdata');no = gu('scaling.pop.value');scale = gu('scale');sc = scale{no};x = readdata(:, no); if (isempty(sc)) if find(x<0) stdout_snn('Error: to scale with sqrt all data must be > 0\n'); else [y, sc] = sc_log_snn(x); scale{no} = sc; au('scale', scale); au('scaling.next.enable', 'off'); endelse x = scale_snn(x, sc); if find(x<0) stdout_snn('Error: to scale with sqrt all data must be > 0\n'); else [y, sc(prod(size(sc))+1)] = sc_log_snn(x); scale{no} = sc; au('scale', scale); au('scaling.next.enable', 'off'); endendgraphics_snn('scaling');%==================================================================% SCALING_EXP %% GUIF('scaling_exp')%==================================================================elseif strcmp(cmd, 'scaling_exp')readdata = gu('readdata');no = gu('scaling.pop.value');scale = gu('scale');sc = scale{no};x = readdata(:, no); if (isempty(sc)) [y, sc] = sc_exp_snn(x);else [y, sc(prod(size(sc))+1)] = sc_exp_snn(scale_snn(x, sc));endscale{no} = sc;au('scale', scale);au('scaling.next.enable', 'off');graphics_snn('scaling');%==================================================================% SCALING_UNDO %% GUIF('scaling_undo')%==================================================================elseif strcmp(cmd, 'scaling_undo')no = gu('scaling.pop.value');scale = gu('scale');sc = scale{no};if (isempty(sc)) ; % do nothingelse sc = sc(1:prod(size(sc))-1); scale{no} = sc; au('scale', scale); au('scaling.next.enable', 'off');endgraphics_snn('scaling');%==================================================================% SCALING_OK %% GUIF('scaling_ok')%==================================================================elseif strcmp(cmd, 'scaling_ok')data = gu('data');readdata = gu('readdata');scale = gu('scale');ninputs = str2num(gu('import.inputsedit.string'));noutputs = str2num(gu('import.outputsedit.string'));for k = 1:ninputs data.P(k, :) = scale_snn(readdata(:, k), scale{k});endfor k = 1:noutputs data.T(k, :) = scale_snn(readdata(:, k+ninputs), scale{k+ninputs});endau('data', data);au('scaling.next.enable', 'on');au('arch.next.enable', 'off');graphics_snn('architecture');%==================================================================% SCALING_PREVIOUS %% GUIF('scaling_previous')%==================================================================elseif strcmp(cmd, 'scaling_previous')graphics_snn('import');%==================================================================% SCALING_HELP %% GUIF('scaling_help')%==================================================================elseif strcmp(cmd, 'scaling_help')popup_message_snn('Sorry, no help available.');%==================================================================% SCALING_NEXT %% GUIF('scaling_next')%==================================================================elseif strcmp(cmd, 'scaling_next')graphics_snn('architecture');%==================================================================%==================================================================% ARCH_LAYEREDIT %% GUIF('arch_layeredit')%==================================================================elseif strcmp(cmd, 'arch_layeredit')L = str2num(get(gcbo, 'String'));au('arch.nlayers', str2num(get(gcbo, 'String'))); NL = gu('arch.nunits');transvalues = gu('arch.transfervalues');NLL = size(NL, 2);if (NLL > L) NL = NL(1:(L)); transvalues = [transvalues(1:(L)) transvalues(NLL+1)];else NL = [NL ones(1, L-NLL)]; transvalues = [transvalues(1:NLL) ones(1, L-NLL) transvalues(NLL+1)];endau('arch.nunits', NL);au('arch.transfervalues', transvalues);graphics_snn('architecture');%==================================================================% ARCH_INPUTNAMESEDIT%% GUIF('arch_inputnamesedit')%==================================================================elseif strcmp(cmd, 'arch_inputnamesedit')inputnames = gu('arch.inputnames');inputnames(get(gcbo, 'UserData')) = get(gcbo, 'String');au('arch.inputnames', inputnames);%==================================================================% ARCH_OUTPUTNAMESEDIT%% GUIF('arch_outputnamesedit')%==================================================================elseif strcmp(cmd, 'arch_outputnamesedit')outputnames = gu('arch.outputnames');outputnames(get(gcbo, 'UserData')) = get(gcbo, 'String');au('arch.outputnames', outputnames);%==================================================================% ARCH_UNITEDIT %% GUIF('arch_unitedit')%==================================================================elseif strcmp(cmd, 'arch_unitedit')nunits = gu('arch.nunits');nunits(get(gcbo, 'UserData')) = str2num(get(gcbo, 'String'));au('arch.nunits', nunits);graphics_snn('architecture');%==================================================================% ARCH_TRANSFER %% GUIF('arch_transfer')%==================================================================elseif strcmp(cmd, 'arch_transfer')tfvalues = gu('arch.transfervalues');tfvalues(get(gcbo, 'UserData')) = get(gcbo, 'Value');au('arch.transfervalues', tfvalues);%graphics_snn('architecture');%==================================================================% ARCH_OK %% GUIF('arch_ok')%==================================================================elseif strcmp(cmd, 'arch_ok')au('arch.next.enable', 'on');au('parameters.next.enable', 'off');graphics_snn('parameters');%==================================================================% ARCH_PREVIOUS %% GUIF('arch_previous')%==================================================================elseif strcmp(cmd, 'arch_previous')graphics_snn('scaling');%==================================================================% ARCH_HELP %% GUIF('arch_help')%==================================================================elseif strcmp(cmd, 'arch_help')popup_message_snn('Sorry, no help available.');%==================================================================% ARCH_NEXT %% GUIF('arch_next')%==================================================================elseif strcmp(cmd, 'arch_next')graphics_snn('parameters');%==================================================================%==================================================================% PARAMETERS_OUTPUTPOP %% GUIF('pr_outputpop')%==================================================================elseif strcmp(cmd, 'pr_outputpop')new = get(gcbo, 'Value');old = gu('parameters.outputpop.value');outputnames = gu('arch.outputnames');if (new ~= old) if (new > prod(size(outputnames))) values = gu('parameters.errorpop.values'); values = values(old) * ones(size(values)); weights = gu('parameters.errorweight'); weights = weights(old) * ones(size(weights)); au('parameters.errorpop.values', values); au('parameters.errorweight', weights); au('parameters.outputpop.value', new); else au('parameters.outputpop.value', new); end graphics_snn('parameter_update'); au('parameters.next.enable', 'off');end%==================================================================% PARAMETERS_ERRORPOP %% GUIF('pr_errorpop')%==================================================================elseif strcmp(cmd, 'pr_errorpop')new = get(gcbo, 'Value');outputpopvalue = gu('parameters.outputpop.value');outputnames = gu('arch.outputnames');if (outputpopvalue > prod(size(outputnames))) errorpopvalues = gu('parameters.errorpop.values'); errorpopvalues = new * ones(size(errorpopvalues)); au('parameters.errorpop.values', errorpopvalues); au('parameters.next.enable', 'off'); graphics_snn('parameter_update');else errorpopvalues = gu('parameters.errorpop.values'); if (errorpopvalues(outputpopvalue) ~= new) errorpopvalues(outputpopvalue) = new; au('parameters.errorpop.values', errorpopvalues); au('parameters.next.enable', 'off'); graphics_snn('parameter_update'); endend%==================================================================% PARAMETERS_WEIGHTEDIT %% GUIF('pr_weightedit')%==================================================================elseif strcmp(cmd, 'pr_weightedit')new = str2num(get(gcbo, 'String'));outputpopvalue = gu('parameters.outputpop.value');outputnames = gu('arch.outputnames');if (outputpopvalue > prod(size(outputnames))) errorweight = gu('parameters.errorweight'); errorweight = new * ones(size(errorweight)); au('parameters.errorweight', errorweight); au('parameters.next.enable', 'off'); graphics_snn('parameter_update');else errorweight = gu('parameters.errorweight'); if (errorweight(outputpopvalue) ~= new) errorweight(outputpopvalue) = new; au('parameters.errorweight', errorweight); au('parameters.next.enable', 'off'); graphics_snn('parameter_update'); endend%==================================================================% PARAMETERS_POPALG %% GUIF('pr_popalg')%==================================================================elseif strcmp(cmd, 'pr_popalg')new = get(gcbo, 'Value');if (new ~= gu('parameters.algvalue')); au('parameters.algvalue', new); au('parameters.next.enable', 'off'); graphics_snn('parameters');
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?