graphics_snn.m
来自「神经网络的工具箱, 神经网络的工具箱,」· M 代码 · 共 2,139 行 · 第 1/5 页
M
2,139 行
'ListboxTop',0, ... 'Position',[40 267 180 20], ... 'String','Epochs:', ... 'Style','text', ... 'Tag','pr_epochtxt', ... 'Visible', 'on');handles.parameters.epochedit = ... uicontrol('Parent',h0, ... 'Units','pixels', ... 'Callback','guif(''pr_epochedit'')', ... 'Interruptible', 'off', ... 'BackgroundColor',[1 1 1], ... 'HorizontalAlignment','right', ... 'ListboxTop',0, ... 'Position',[220 270 50 20], ... 'String', num2str(parameters.epochs), ... 'Style','edit', ... 'Tag','pr_epochedit', ... 'UserData', 1, ... 'Visible','on');handles.parameters.sucfailtext = ... uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'FontWeight','bold', ... 'HorizontalAlignment','left', ... 'ListboxTop',0, ... 'Position',[40 242 180 20], ... 'String','Succesive validation failures:', ... 'Style','text', ... 'Tag','pr_sucfailtxt', ... 'Visible', 'on');handles.parameters.sucfailedit = ... uicontrol('Parent',h0, ... 'Units','pixels', ... 'Callback','guif(''pr_sucfailedit'')', ... 'Interruptible', 'off', ... 'BackgroundColor',[1 1 1], ... 'HorizontalAlignment','right', ... 'ListboxTop',0, ... 'Position',[220 245 50 20], ... 'String', num2str(parameters.sucfail), ... 'Style','edit', ... 'Tag','pr_sucfailedit', ... 'Visible','on');handles.parameters.totalfailtext = ... uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'FontWeight','bold', ... 'HorizontalAlignment','left', ... 'ListboxTop',0, ... 'Position',[40 217 180 20], ... 'String','Total validation failures:', ... 'Style','text', ... 'Tag','pr_totalfailtxt', ... 'Visible', 'on');handles.parameters.totalfailedit = ... uicontrol('Parent',h0, ... 'Units','pixels', ... 'Callback','guif(''pr_totalfailedit'')', ... 'Interruptible', 'off', ... 'BackgroundColor',[1 1 1], ... 'HorizontalAlignment','right', ... 'ListboxTop',0, ... 'Position',[220 220 50 20], ... 'String', num2str(parameters.totfail), ... 'Style','edit', ... 'Tag','pr_totalfailedit', ... 'Visible','on');handles.parameters.timetext = ... uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'FontWeight','bold', ... 'HorizontalAlignment','left', ... 'ListboxTop',0, ... 'Position',[40 192 180 20], ... 'String','Time (sec):', ... 'Style','text', ... 'Tag','pr_timetxt', ... 'Visible', 'on');handles.parameters.timeedit = ... uicontrol('Parent',h0, ... 'Units','pixels', ... 'Callback','guif(''pr_timeedit'')', ... 'Interruptible', 'off', ... 'BackgroundColor',[1 1 1], ... 'HorizontalAlignment','right', ... 'ListboxTop',0, ... 'Position',[220 195 50 20], ... 'String', num2str(parameters.time), ... 'Style','edit', ... 'Tag','pr_timedit', ... 'Visible','on');handles.parameters.ok = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''pr_ok'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[470 140 60 20], ... 'String','OK', ... 'Tag','pr_ok', ... 'Visible', 'on');handles.parameters.expframe = uicontrol('Parent',h0, ... 'Units', 'pixels', ... 'BackgroundColor',[0.7 0.7 0.7], ... 'ListboxTop',0, ... 'Position',[550 20 210 550], ... 'Style','frame', ... 'Tag','pr_expframe', ... 'Visible', 'on' );handles.parameters.previous = uicontrol('Parent',h0, ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''pr_previous'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[410 110 30 20], ... 'String',' < ', ... 'Tag','pr_previous', ... 'Visible', 'on');handles.parameters.help = uicontrol('Parent',h0, ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''pr_help'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[440 110 60 20], ... 'String','Help', ... 'Tag','pr_help', ... 'Visible', 'on');handles.parameters.next = uicontrol('Parent',h0, ... 'Enable', parameters.next.enable, ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''pr_next'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[500 110 30 20], ... 'String','>', ... 'Tag','pr_next', ... 'Visible', 'on');text = {... '', ... '', ... '', ... '1. ', ... '', ... 'The neural networks will be trained by', ... 'minimizing an error.', ... 'This error is a weighted average over', ... 'the outputs.'... 'For each output an output error', ... 'function and its weight can be selected.', ... '', ... '', ... '2. ', ... '', ... 'Choose the training algorithm and', ... 'select training parameters.', ... '', ... '', ... '3. ', ... '', ... 'Training will be stopped when the error', ... 'is zero or if one of the stopping', ... 'criteria is met.', ... 'Choose your stopping criteria.', ... '', ... '', ... '4. ', ... '', ... 'Press ''OK'' to continue.', ... };handles.parameters.exptext = uicontrol('Parent',h0, ... 'Units', 'pixels', ... 'Position',[560 30 190 530], ... 'Style','text', ... 'String', text, ... 'HorizontalAlignment', 'left', ... 'Tag','pr_exptext');auf(fig, 'handles.parameters', handles.parameters);stdout(fig);%==================================================================function parameter_update(fig)handles = guf(fig, 'handles');parameters = guf(fig, 'parameters');set(handles.parameters.outputpop, 'Value', parameters.outputpop.value);outputnames = guf(fig, 'arch.outputnames');if (parameters.outputpop.value > prod(size(outputnames))) %all outputs value = parameters.errorpop.values(1); string = parameters.errorweight(1);else value = parameters.errorpop.values(parameters.outputpop.value); string = parameters.errorweight(parameters.outputpop.value);endset(handles.parameters.errorpop, 'Value', value);set(handles.parameters.weightedit, 'String', string);set(handles.parameters.algpop, 'Value', parameters.algvalue);if (isfield(handles.parameters.dynamic, 'mumaxedit')) set(handles.parameters.dynamic.mumaxedit, ... 'String', num2str(parameters.mumax, 5));endif (isfield(handles.parameters.dynamic, 'muincedit')) set(handles.parameters.dynamic.muincedit, ... 'String', num2str(parameters.muinc, 5));endif (isfield(handles.parameters.dynamic, 'mudecedit')) set(handles.parameters.dynamic.mudecedit, ... 'String', num2str(parameters.mudec, 5));endif (isfield(handles.parameters.dynamic, 'toledit')) set(handles.parameters.dynamic.toledit, ... 'String', num2str(parameters.tol, 5));endif (isfield(handles.parameters.dynamic, 'lredit')) set(handles.parameters.dynamic.lredit, ... 'String', num2str(parameters.lr, 5));endset(handles.parameters.epochedit, 'String', num2str(parameters.epochs));set(handles.parameters.sucfailedit, 'String', num2str(parameters.sucfail));set(handles.parameters.totalfailedit, 'String', num2str(parameters.totfail));set(handles.parameters.timeedit, 'String', num2str(parameters.time));set(handles.parameters.next, 'Enable', parameters.next.enable);%==================================================================function ensemble(fig)ensemble = guf(fig, 'ensemble');h0 = fig;handles.ensemble.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','Train network ensemble', ... 'Style','text', ... 'Tag','ens_title', ... 'Visible', 'on');handles.ensemble.axes = axes('Parent',h0', ... 'Units', 'pixels', ... 'Position', [60 180 390 260], ... 'Tag', 'ens_picture', ... 'Visible', 'on'); if strcmp(guf(fig, 'ensemble.ok.enable'), 'on') if (isfield(get(fig, 'UserData'), 'trrecords')) trrecords = guf(fig, 'trrecords'); max = size(trrecords, 2); plotperf_snn(trrecords(max).tr); end else axis('off'); endhandles.ensemble.nensmebletext = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'FontWeight','bold', ... 'HorizontalAlignment','left', ... 'ListboxTop',0, ... 'Position',[20 501 200 20], ... 'String','Number of networks in ensemble:', ... 'Style','text', ... 'Tag','ens_nensembletext', ... 'Visible','on');handles.ensemble.nensembleedit = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Callback','guif(''ens_nensembleedit'')', ... 'Interruptible', 'off', ... 'BackgroundColor',[1 1 1], ... 'HorizontalAlignment','right', ... 'ListboxTop',0, ... 'Position',[215 505 40 20], ... 'Style','edit', ... 'String', num2str(ensemble.nensemble), ... 'Tag','ens_nensembleedit', ... 'Visible','on');handles.ensemble.sampletext = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'FontWeight','bold', ... 'HorizontalAlignment','left', ... 'ListboxTop',0, ... 'Position',[20 471 150 20], ... 'String','Sampling method:', ... 'Style','text', ... 'Tag','ens_sampletext', ... 'Visible','on');handles.ensemble.samplepop = ... uicontrol('Parent',h0, ... 'Units','pixels', ... 'Callback','guif(''ens_samplepop'')', ... 'Interruptible', 'off', ... 'HorizontalAlignment','left', ... 'ListboxTop',1, ... 'Position', [135 474 120 20], ... 'String', ensemble.samplemethod, ... 'Style','popup', ... 'Tag','ens_samplepop', ... 'Value', ensemble.samplevalue, ... 'Visible','on');handles.ensemble.start = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''ens_start'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[440 474 90 20], ... 'String','Start training', ... 'Tag','ens_start', ... 'Visible', 'on');handles.ensemble.ok = uicontrol('Parent',h0, ... 'Enable', ensemble.ok.enable, ... 'Units','pixels', ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''ens_ok'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[470 140 60 20], ... 'String','OK', ... 'Tag','ens_ok', ... 'Visible', 'on');handles.ensemble.previous = uicontrol('Parent',h0, ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''ens_previous'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[410 110 30 20], ... 'String',' < ', ... 'Tag','ens_previous', ... 'Visible', 'on');handles.ensemble.help = uicontrol('Parent',h0, ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''ens_help'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[440 110 60 20], ... 'String','Help', ... 'Tag','ens_help', ... 'Visible', 'on');handles.ensemble.next = uicontrol('Parent',h0, ... 'Enable', ensemble.next.enable, ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''ens_next'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[500 110 30 20], ... 'String','>', ... 'Tag','ensemble_next', ... 'Visible', 'on');handles.ensemble.expframe = uicontrol('Parent',h0, ... 'Units', 'pixels', ... 'BackgroundColor',[0.7 0.7 0.7], ... 'ListboxTop',0, ... 'Position',[550 20 210 550], ... 'Style','frame', ... 'Visible', 'on', ... 'Tag','ens_expframe', ... 'Visible', 'on');text = {... '', ... '', ... '', ... '1. ', ... '', ... 'Confidence and prediction intervals are,', ... 'computed from an ensemble of networks.', ... 'Please set the number of networks to', ... 'be trained and the sampling method to use.', ... '', ... '', ... '2. ', ... '', ... 'Press ''Start training'' to start training the ensemble.', ... '(this may take a while).', ... '', ... '', ... '3. ', ... '', ... 'When training is finished, press ''OK'' to continue.', ... };handles.ensemble.exptext = uicontrol('Parent',h0, ... 'Units', 'pixels', ... 'Position',[560 30 190 530], ... 'Style','text', ... 'String', text, ... 'HorizontalAlignment', 'left', ... 'Tag','ens_exptext');auf(fig, 'handles.ensemble', handles.ensemble);stdout(fig);%==================================================================function ensemble_update(fig)handles = guf(fig, 'handles');ensemble = guf(fig, 'ensemble');if strcmp(ensemble.ok.enable, 'on') if (isfield(get(fig, 'UserData'), 'trrecords')) trrecords = guf(fig, 'trrecords'); max = size(trrecords, 2); plotperf_snn(trrecords(max).tr); endelse cla('reset'); axis('off');endset(handles.ensemble.nensembleedit, 'String', num2str(ensemble.nensemble));set(handles.ensemble.samplepop, 'Value', ensemble.samplevalue);set(handles.ensemble.ok, 'Enable', ensemble.ok.enable);set(handles.ensemble.next, 'Enable', ensemble.next.enable);%==================================================================function remove_outliers(fig)remove = guf(fig, 'remove');h0 = fig;handles.remove.title = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.7 0.8 0.8], ... 'FontSize', 18, ...
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?