graphics_snn.m

来自「神经网络的工具箱, 神经网络的工具箱,」· M 代码 · 共 2,139 行 · 第 1/5 页

M
2,139
字号
endhandles.arch.dynamic.transfertext = ...        uicontrol('Parent',h0, ...	'Units','pixels', ...	'BackgroundColor',[0.8 0.8 0.8], ...	'FontWeight','bold', ...	'HorizontalAlignment','left', ...	'ListboxTop',0, ...	'Position',[20 171 135 20], ...	'String','Transferfunction:', ...	'Style','text', ...	'Tag','arch_transfertext', ...	'Visible','on');for i = 1:(L+1)    l = i+1;    x0 = 80 + 390*(0.5 + dx*(l - (L+3)/2));     Position = [(x0- 90/2) 175 90 20];    handles.arch.dynamic.transpop(i) = ...       uicontrol('Parent',h0, ...	'Units','pixels', ...	'Callback','guif(''arch_transfer'')', ...	'Interruptible', 'off', ...	'HorizontalAlignment','right', ...	'ListboxTop',1, ...	'Position', Position, ...	'String', arch.transferfunctions, ...	'Style','popup', ...	'Tag','arch_transpop', ...        'Value', arch.transfervalues(i), ...        'UserData', i, ...	'Visible','on');endhandles.arch.ok = uicontrol('Parent',h0, ...        'Enable', arch.ok.enable, ...	'Units','pixels', ...	'BackgroundColor',[0.7 0.7 0.7], ...	'Callback','guif(''arch_ok'')', ...	'Interruptible', 'off', ...	'ListboxTop',0, ...	'Position',[470 140 60 20], ...	'String','OK', ...	'Tag','arch_ok');handles.arch.previous = uicontrol('Parent',h0, ...	'BackgroundColor',[0.7 0.7 0.7], ...	'Callback','guif(''arch_previous'')', ...	'Interruptible', 'off', ...	'ListboxTop',0, ...	'Position',[410 110 30 20], ...	'String',' < ', ...	'Tag','arch_previous');handles.arch.help = uicontrol('Parent',h0, ...	'BackgroundColor',[0.7 0.7 0.7], ...	'Callback','guif(''arch_help'')', ...	'Interruptible', 'off', ...	'ListboxTop',0, ...	'Position',[440 110 60 20], ...	'String','Help', ...	'Tag','arch_help');handles.arch.next = uicontrol('Parent',h0, ...        'Enable', arch.next.enable, ...	'BackgroundColor',[0.7 0.7 0.7], ...	'Callback','guif(''arch_next'')', ...	'Interruptible', 'off', ...	'ListboxTop',0, ...	'Position',[500 110 30 20], ...	'String','>', ...	'Tag','arch_next');handles.arch.expframe = uicontrol('Parent',h0, ...        'Units', 'pixels', ...        'BackgroundColor',[0.7 0.7 0.7], ...        'ListboxTop',0, ...        'Position',[550 20 210 550], ...        'Style','frame', ...        'Tag','arch_expframe');text = {...        '', ...        '', ...        '', ...        '1. ', ...        '', ...	'Insert the number of hidden layers for', ...        'the network.', ...        '', ...        '', ...        '2. ', ...        '', ...        'You can change the names of inputs and outputs.', ...        '', ...        '', ...        '3. ', ...        '', ...	'For each hidden layer, set the number ', ...	'of units and the transferfunction.', ...        '', ...        '', ...        '4. ', ...        '', ...        'Set the transferfunction for the output layer also.', ...        '', ...        '', ...        '5. ', ...        '', ...	'Press ''OK'' to continue.', ...        };handles.arch.exptext = uicontrol('Parent',h0, ...        'Units', 'pixels', ...        'Position',[560 30 190 530], ...        'Style','text', ...	'String', text, ...	'HorizontalAlignment', 'left', ...        'Tag','arch_exptext');auf(fig, 'handles.arch', handles.arch);stdout(fig);%==================================================================function parameters(fig)parameters = guf(fig, 'parameters');h0 = fig;handles.parameters.title = ...       uicontrol('Parent',h0, ...        'Units','pixels', ...        'BackgroundColor', [0.7 0.8 0.8], ...        'FontSize', 18, ...        'HorizontalAlignment','left', ...        'ListboxTop',0, ...        'Position', [20 540 510 30] , ...        'String','Training parameters', ...        'Style','text', ...        'Tag','pr_title', ...        'Visible', 'on');handles.parameters.errorfunctiontext = ...        uicontrol('Parent',h0, ...        'Units','pixels', ...        'BackgroundColor',[0.8 0.8 0.8], ...        'FontWeight','bold', ...        'FontSize', 12, ...        'HorizontalAlignment','left', ...        'ListboxTop',0, ...        'Position',[20 497 120 20], ...        'String','Output:', ...        'Style','text', ...        'Tag','pr_tx1', ...        'Visible', 'on');outputnames = guf(fig, 'arch.outputnames');text = [outputnames; {'All outputs'}];handles.parameters.outputpop = ...       uicontrol('Parent',h0, ...        'Units','pixels', ...        'Callback','guif(''pr_outputpop'')', ...	'Interruptible', 'off', ...        'HorizontalAlignment','left', ...        'FontSize', 12, ...        'ListboxTop',1, ...        'Position', [125 500 150 20], ...        'String', text, ...        'Style','popup', ...        'Tag','pr_pop1', ...        'Value', parameters.outputpop.value, ...        'Visible','on');handles.parameters.errortext = ...        uicontrol('Parent',h0, ...        'Units','pixels', ...        'BackgroundColor',[0.8 0.8 0.8], ...        'FontWeight','bold', ...        'HorizontalAlignment','left', ...        'ListboxTop',0, ...        'Position',[40 457 130 20], ...        'String','Output error function:', ...        'Style','text', ...        'Tag','pr_tx2', ...        'Visible', 'on');if (parameters.outputpop.value > prod(size(outputnames)))   %all outputs   value = parameters.errorpop.values(1);else   value = parameters.errorpop.values(parameters.outputpop.value);endhandles.parameters.errorpop = ...       uicontrol('Parent',h0, ...        'Units','pixels', ...        'Callback','guif(''pr_errorpop'')', ...	'Interruptible', 'off', ...        'HorizontalAlignment','left', ...        'ListboxTop',1, ...        'Position', [170 460 100 20], ...        'String', parameters.errorfunctions, ...         'Style','popup', ...        'Tag','pr_pop2', ...        'Value', value, ...        'Visible','on');handles.parameters.weighttext = ...       uicontrol('Parent',h0, ...        'Units','pixels', ...        'BackgroundColor',[0.8 0.8 0.8], ...        'FontWeight','bold', ...        'HorizontalAlignment','left', ...        'ListboxTop',0, ...        'Position',[280 457 50 20], ...        'String','Weight:', ...        'Style','text', ...        'Tag','pr_tx2', ...        'Visible', 'on');if (parameters.outputpop.value > prod(size(outputnames)))   %all outputs   string = parameters.errorweight(1);else  % all outputs.   string = parameters.errorweight(parameters.outputpop.value);endhandles.parameters.weightedit = ...       uicontrol('Parent',h0, ...	'Units','pixels', ...	'Callback','guif(''pr_weightedit'')', ...	'Interruptible', 'off', ...	'BackgroundColor',[1 1 1], ...	'HorizontalAlignment','right', ...	'ListboxTop',0, ...	'Position',[330 460 20 20], ...	'String', string, ...	'Style','edit', ...	'Tag','pr_weightedit', ...        'UserData', 1, ...	'Visible','on');handles.parameters.line1 = uicontrol('Parent',h0, ...	'Enable', 'off', ...	'Units','pixels', ...	'BackgroundColor',[0.7 0.8 0.8], ...	'HorizontalAlignment','left', ...	'ListboxTop',0, ...	'Position',[20 435 510 10], ...	'String','', ...	'Style','text', ...	'Tag','pr_line', ...	'Visible','on');handles.parameters.algtext = ...        uicontrol('Parent',h0, ...        'Units','pixels', ...        'BackgroundColor',[0.8 0.8 0.8], ...        'FontWeight','bold', ...        'FontSize', 12, ...        'HorizontalAlignment','left', ...        'ListboxTop',0, ...        'Position',[20 397 160 20], ...        'String','Training algorithm:', ...        'Style','text', ...        'Tag','pr_algtext', ...        'Visible', 'on');handles.parameters.algpop = ...       uicontrol('Parent',h0, ...        'Units','pixels', ...        'Callback','guif(''pr_popalg'')', ...	'Interruptible', 'off', ...        'HorizontalAlignment','left', ...        'FontSize', 12, ...        'ListboxTop',1, ...        'Position', [180 400 120 20], ...        'String', parameters.algorithms, ...        'Style','popup', ...        'Tag','pr_popalg', ...        'Value', parameters.algvalue, ...        'Visible','on');if (parameters.algvalue == 1)   % Levenberg-Maq.   handles.parameters.dynamic.mumaxtext = ...        uicontrol('Parent',h0, ...        'Units','pixels', ...        'BackgroundColor',[0.8 0.8 0.8], ...        'FontWeight','bold', ...        'HorizontalAlignment','left', ...        'ListboxTop',0, ...        'Position',[40 357 60 20], ...        'String','Mu_max:', ...        'Style','text', ...        'Tag','pr_mumaxtxt', ...        'Visible', 'on');   handles.parameters.dynamic.mumaxedit = ...       uicontrol('Parent',h0, ...	'Units','pixels', ...	'Callback','guif(''pr_mumaxedit'')', ...	'Interruptible', 'off', ...	'BackgroundColor',[1 1 1], ...	'HorizontalAlignment','right', ...	'ListboxTop',0, ...	'Position',[100 360 50 20], ...	'String', num2str(parameters.mumax, 5), ...	'Style','edit', ...	'Tag','pr_mumaxedit', ...        'UserData', 1, ...	'Visible','on');   handles.parameters.dynamic.muinctext = ...        uicontrol('Parent',h0, ...        'Units','pixels', ...        'BackgroundColor',[0.8 0.8 0.8], ...        'FontWeight','bold', ...        'HorizontalAlignment','left', ...        'ListboxTop',0, ...        'Position',[160 357 60 20], ...        'String','Mu_inc:', ...        'Style','text', ...        'Tag','pr_muinctxt', ...        'Visible', 'on');   handles.parameters.dynamic.mumincedit = ...       uicontrol('Parent',h0, ...	'Units','pixels', ...	'Callback','guif(''pr_muincedit'')', ...	'Interruptible', 'off', ...	'BackgroundColor',[1 1 1], ...	'HorizontalAlignment','right', ...	'ListboxTop',0, ...	'Position',[220 360 50 20], ...	'String', num2str(parameters.muinc), ...	'Style','edit', ...	'Tag','pr_muincedit', ...        'UserData', 1, ...	'Visible','on');   handles.parameters.dynamic.mudectext = ...        uicontrol('Parent',h0, ...        'Units','pixels', ...        'BackgroundColor',[0.8 0.8 0.8], ...        'FontWeight','bold', ...        'HorizontalAlignment','left', ...        'ListboxTop',0, ...        'Position',[280 357 60 20], ...        'String','Mu_dec:', ...        'Style','text', ...        'Tag','pr_mudectxt', ...        'Visible', 'on');   handles.parameters.dynamic.mudecedit = ...       uicontrol('Parent',h0, ...	'Units','pixels', ...	'Callback','guif(''pr_mudecedit'')', ...	'Interruptible', 'off', ...	'BackgroundColor',[1 1 1], ...	'HorizontalAlignment','right', ...	'ListboxTop',0, ...	'Position',[340 360 50 20], ...	'String', num2str(parameters.mudec), ...	'Style','edit', ...	'Tag','pr_mudecedit', ...        'UserData', 1, ...	'Visible','on');elseif (parameters.algvalue == 2)   % Conj. Grad. Polak    handles.parameters.dynamic.toltext = ...        uicontrol('Parent',h0, ...        'Units','pixels', ...        'BackgroundColor',[0.8 0.8 0.8], ...        'FontWeight','bold', ...        'HorizontalAlignment','left', ...        'ListboxTop',0, ...        'Position',[40 357 70 20], ...        'String','Tolerance:', ...        'Style','text', ...        'Tag','pr_toltxt', ...        'Visible', 'on');   handles.parameters.dynamic.toledit = ...       uicontrol('Parent',h0, ...	'Units','pixels', ...	'Callback','guif(''pr_toledit'')', ...	'Interruptible', 'off', ...	'BackgroundColor',[1 1 1], ...	'HorizontalAlignment','right', ...	'ListboxTop',0, ...	'Position',[110 360 50 20], ...	'String', num2str(parameters.tol, 5), ...	'Style','edit', ...	'Tag','pr_toledit', ...        'UserData', 1, ...	'Visible','on');else  % Grading Descent   handles.parameters.dynamic.lrtext = ...        uicontrol('Parent',h0, ...        'Units','pixels', ...        'BackgroundColor',[0.8 0.8 0.8], ...        'FontWeight','bold', ...        'HorizontalAlignment','left', ...        'ListboxTop',0, ...        'Position',[40 357 80 20], ...        'String','Learning rate:', ...        'Style','text', ...        'Tag','pr_lrtxt', ...        'Visible', 'on');   handles.parameters.dynamic.lredit = ...       uicontrol('Parent',h0, ...	'Units','pixels', ...	'Callback','guif(''pr_lredit'')', ...	'Interruptible', 'off', ...	'BackgroundColor',[1 1 1], ...	'HorizontalAlignment','right', ...	'ListboxTop',0, ...	'Position',[130 360 50 20], ...	'String', num2str(parameters.lr, 5), ...	'Style','edit', ...	'Tag','pr_lredit', ...        'UserData', 1, ...	'Visible','on');endhandles.parameters.line2 = uicontrol('Parent',h0, ...	'Enable', 'off', ...	'Units','pixels', ...	'BackgroundColor',[0.7 0.8 0.8], ...	'HorizontalAlignment','left', ...	'ListboxTop',0, ...	'Position',[20 330 510 10], ...	'String','', ...	'Style','text', ...	'Tag','pr_line2', ...	'Visible','on');handles.parameters.stoptext = ...        uicontrol('Parent',h0, ...        'Units','pixels', ...        'BackgroundColor',[0.8 0.8 0.8], ...        'FontWeight','bold', ...        'FontSize', 12, ...        'HorizontalAlignment','left', ...        'ListboxTop',0, ...        'Position',[20 300 200 20], ...        'String','Stop training when:', ...        'Style','text', ...        'Tag','pr_stoptext', ...        'Visible', 'on');handles.parameters.epochstext = ...        uicontrol('Parent',h0, ...        'Units','pixels', ...        'BackgroundColor',[0.8 0.8 0.8], ...        'FontWeight','bold', ...        'HorizontalAlignment','left', ...

⌨️ 快捷键说明

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