graphics_snn.m
来自「神经网络的工具箱, 神经网络的工具箱,」· M 代码 · 共 2,139 行 · 第 1/5 页
M
2,139 行
'HorizontalAlignment','left', ... 'ListboxTop',0, ... 'Position', [20 540 510 30] , ... 'String','Remove outliers', ... 'Style','text', ... 'Tag','rm_title', ... 'Visible', 'on');handles.remove.axes = axes('Parent',h0', ... 'Units', 'pixels', ... 'Position', [60 280 330 220], ... 'Tag', 'rm_picture', ... 'Visible', 'on'); xlabel('observed over expected training error'); ylabel('observed over expected validation error');errors = remove.errors; exp_errors = remove.exp_errors; M = size(errors.validation,2);marker(1:M) = 'o';marker(find(remove.net_used)) = '+';for m = 1:M handles.remove.point(m) = ... line(errors.training(m)/exp_errors.training(m), ... errors.validation(m)/exp_errors.validation(m), ... 'Marker', marker(m), ... 'ButtonDownFcn', 'guif(''rm_mark'')', ... 'UserData', m );endhandles.remove.removetext = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'FontWeight','bold', ... 'HorizontalAlignment','left', ... 'ListboxTop',0, ... 'Position',[20 505 200 20], ... 'String','Mark outliers to be removed:', ... 'Style','text', ... 'Tag','rm_methodtext', ... 'Visible','on');handles.remove.recompute = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''rm_compute'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[470 280 60 25], ... 'String',{'Recompute', 'errors'}, ... 'Tag','rm_recompute', ... 'Visible', 'on');handles.remove.ok = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''rm_ok'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[470 140 60 20], ... 'String','OK', ... 'Tag','rm_ok', ... 'Visible', 'on');handles.remove.previous = uicontrol('Parent',h0, ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''rm_previous'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[410 110 30 20], ... 'String',' < ', ... 'Tag','rm_previous', ... 'Visible', 'on');handles.remove.help = uicontrol('Parent',h0, ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''rm_help'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[440 110 60 20], ... 'String','Help', ... 'Tag','rm_help', ... 'Visible', 'on');handles.remove.next = uicontrol('Parent',h0, ... 'Enable', remove.next.enable, ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''rm_next'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[500 110 30 20], ... 'String','>', ... 'Tag','rm_next', ... 'Visible', 'on');handles.remove.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','rm_expframe', ... 'Visible', 'on');text = {... '', ... '', ... '', ... '1. ', ... '', ... 'Not every netwok in the ensemble', ... 'performs well. In this graph you', ... 'can see relative expectation and', ... 'validation errors.', ... 'You can remove networks from the', ... 'ensemble by clicking the crosses (+).', ... '', ... 'By removing a network the expected', ... 'errors will change. To recompute these', ... 'press ''Recompute''.', ... '', ... '', ... '2. ', ... '', ... 'Press ''OK'' to continue.', ... };handles.remove.exptext = uicontrol('Parent',h0, ... 'Units', 'pixels', ... 'Position',[560 30 190 530], ... 'Style','text', ... 'String', text, ... 'HorizontalAlignment', 'left', ... 'Tag','rm_exptext');auf(fig, 'handles.remove', handles.remove);stdout(fig);%==================================================================function remove_update(fig)handles = guf(fig, 'handles');remove = guf(fig, 'remove');set(handles.remove.next, 'Enable', remove.next.enable);%==================================================================function average_ensemble(fig)average = guf(fig, 'average');h0 = fig;handles.average.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','Average ensemble', ... 'Style','text', ... 'Tag','av_title', ... 'Visible', 'on');handles.average.methodtext = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'FontWeight','bold', ... 'HorizontalAlignment','left', ... 'ListboxTop',0, ... 'Position',[20 500 170 20], ... 'String','Ensemble averaging method:', ... 'Style','text', ... 'Tag','av_methodtext', ... 'Visible','on');handles.average.methodpop = uicontrol(... 'Units', 'pixels', ... 'Callback', 'guif(''av_methodpop'')', ... 'Interruptible', 'off', ... 'Style','popup', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'Position',[220 503 100 20], ... 'HorizontalAlignment','left', ... 'String', average.methodpoptext, ... 'Value', average.method);offset = 500;if (average.method == 1) handles.average.bootntext = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'FontWeight','bold', ... 'HorizontalAlignment','left', ... 'ListboxTop',0, ... 'Position',[20 467 150 20], ... 'String','Number of bootstraps:', ... 'Style','text', ... 'Tag','av_bootntext', ... 'Visible','on'); handles.average.bootnedit = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Callback','guif(''av_bootnedit'')', ... 'Interruptible', 'off', ... 'BackgroundColor',[1 1 1], ... 'HorizontalAlignment','right', ... 'ListboxTop',0, ... 'Position',[150 470 40 20], ... 'Style','edit', ... 'String', num2str(average.bootn), ... 'Tag','av_bootnedit', ... 'Visible','on'); offset = 470;elseif (average.method == 4) handles.average.crankstext = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'FontWeight','bold', ... 'HorizontalAlignment','left', ... 'ListboxTop',0, ... 'Position',[20 467 150 20], ... 'String','Number of cranks:', ... 'Style','text', ... 'Tag','av_cracktext', ... 'Visible','on'); handles.average.crankedit = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Callback','guif(''av_crankedit'')', ... 'Interruptible', 'off', ... 'BackgroundColor',[1 1 1], ... 'HorizontalAlignment','right', ... 'ListboxTop',0, ... 'Position',[150 470 40 20], ... 'Style','edit', ... 'String', num2str(average.cranks), ... 'Tag','av_crackedit', ... 'Visible','on'); offset = 470;endhandles.average.start = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''av_start'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[440 offset 90 20], ... 'String','Compute weights', ... 'Tag','av_start', ... 'Visible', 'on');handles.average.axes = axes('Parent',h0', ... 'Units', 'pixels', ... 'Position', [60 300 330 120], ... 'Tag', 'av_picture', ... 'Visible', 'on'); if strcmp(guf(fig, 'average.ok.enable'), 'on') net_used = guf(fig, 'remove.net_used'); M = prod(size(net_used)); alfa = guf(fig, 'alfa'); allalfa = zeros(1,M); allalfa(guf(fig, 'average.over')) = alfa; bar([1:M], allalfa); axis([0.5 M+0.5 0 1]); else axis('off'); endhandles.average.ok = uicontrol('Parent',h0, ... 'Enable', average.ok.enable, ... 'Units','pixels', ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''av_ok'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[470 140 60 20], ... 'String','OK', ... 'Tag','av_ok', ... 'Visible', 'on');handles.average.previous = uicontrol('Parent',h0, ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''av_previous'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[410 110 30 20], ... 'String',' < ', ... 'Tag','av_previous', ... 'Visible', 'on');handles.average.help = uicontrol('Parent',h0, ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''av_help'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[440 110 60 20], ... 'String','Help', ... 'Tag','av_help', ... 'Visible', 'on');handles.average.next = uicontrol('Parent',h0, ... 'Enable', average.next.enable, ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''av_next'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[500 110 30 20], ... 'String','>', ... 'Tag','av_next', ... 'Visible', 'on');handles.average.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','av_expframe', ... 'Visible', 'on');text = {... '', ... '', ... '', ... '1. ', ... '', ... 'Select the averaging method.', ... '', ... '', ... '2. ', ... '', ... 'Press ''Compute weights''.', ... '', ... '', ... '3. ', ... '', ... 'Press ''OK'' to continue.', ... };handles.average.exptext = uicontrol('Parent',h0, ... 'Units', 'pixels', ... 'Position',[560 30 190 530], ... 'Style','text', ... 'String', text, ... 'HorizontalAlignment', 'left', ... 'Tag','av_exptext');auf(fig, 'handles.average', handles.average);stdout(fig);%==================================================================function average_update(fig)handles = guf(fig, 'handles');average = guf(fig, 'average');set(handles.average.methodpop, 'Value', average.method);if (average.method == 1) set(handles.average.bootnedit, 'String', num2str(average.bootn));elseif (average.method == 4) set(handles.average.crankedit, 'String', num2str(average.cranks));endif strcmp(guf(fig, 'average.ok.enable'), 'on') net_used = guf(fig, 'remove.net_used'); M = prod(size(net_used)); alfa = guf(fig, 'alfa'); allalfa = zeros(1,M); allalfa(guf(fig, 'average.over')) = alfa; bar([1:M], allalfa); axis([0.5 M+0.5 0 1]);else cla('reset'); axis('off');endset(handles.average.ok, 'Enable', average.ok.enable);set(handles.average.next, 'Enable', average.next.enable);%==================================================================function compute_intervals(fig)intervals = guf(fig, 'intervals');h0 = fig;handles.intervals.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','Estimate error intervals', ... 'Style','text', ... 'Tag','int_title', ... 'Visible', 'on');handles.intervals.averagetext = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'FontWeight','bold', ... 'HorizontalAlignment','left', ... 'ListboxTop',0, ... 'Position',[20 497 220 20], ... 'String','Summarize networks ...', ... 'Style','text', ... 'Tag','int_eleveltext', ... 'Visible','on');handles.intervals.average = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''int_average'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[410 500 120 20], ... 'String','Summarize', ... 'Tag','int_average', ... 'Visible', 'on');handles.intervals.eleveltext = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'FontWeight','bold', ... 'HorizontalAlignment','left', ... 'ListboxTop',0, ... 'Position',[20 197 80 20], ... 'String','Error level:', ... 'Style','text', ... 'Tag','int_eleveltext', ... 'Visible', intervals.eleveltext.visible);handles.intervals.eleveledit = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[1 1 1], ... 'Callback','guif(''int_eleveledit'')', ... 'Interruptible', 'off', ... 'HorizontalAlignment','left', ... 'ListboxTop',0, ... 'Position',[100 200 40 20], ... 'Style','edit', ... 'String', num2str(intervals.elevel), ... 'Tag', 'int_eleveledit', ... 'Visible', intervals.eleveledit.visible);handles.intervals.compute = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[0.7 0.7 0.7], ... 'Callback','guif(''int_compute'')', ... 'Interruptible', 'off', ... 'ListboxTop',0, ... 'Position',[410 200 120 20], ... 'String','Estimate errors', ... 'Tag','int_compute', ... 'Visible', intervals.compute.visible);handles.intervals.axes = axes('Parent',h0', ... 'Units',
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?