Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/netlab3.3/demnlab.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 function demnlab(action); | |
2 %DEMNLAB A front-end Graphical User Interface to the demos | |
3 % | |
4 % Description | |
5 % This function will start a user interface allowing the user to select | |
6 % different demonstration functions to view. The demos are divided into | |
7 % 4 groups, with the demo being executed by selecting the desired | |
8 % option from a pop-up menu. | |
9 % | |
10 % See also | |
11 % | |
12 | |
13 % Copyright (c) Ian T Nabney (1996-2001) | |
14 | |
15 % If run without parameters, initialise gui. | |
16 if nargin<1, | |
17 action='initialise'; | |
18 end; | |
19 | |
20 if strcmp(action,'initialise'), | |
21 | |
22 % Create figure | |
23 fig = figure( ... | |
24 'Name', 'Netlab Demos', ... | |
25 'NumberTitle', 'off', ... | |
26 'Color', [0.7529 0.7529 0.7529], ... | |
27 'Visible', 'on'); | |
28 | |
29 % Create GROUPS | |
30 % Bottom of demo buttons | |
31 group1_bot = 0.20; | |
32 group1_top = 0.75; | |
33 uicontrol(fig, ... | |
34 'Style', 'frame', ... | |
35 'Units', 'normalized', ... | |
36 'Position', [0.03 group1_bot 0.94 group1_top - group1_bot], ... | |
37 'BackgroundColor', [0.5 0.5 0.5]); | |
38 | |
39 % Bottom of help and close buttons | |
40 group2_bot = 0.04; | |
41 uicontrol(fig, ... | |
42 'Style', 'frame', ... | |
43 'Units', 'normalized', ... | |
44 'Position', [0.03 group2_bot 0.94 0.12], ... | |
45 'BackgroundColor', [0.5 0.5 0.5]); | |
46 | |
47 % Draw title | |
48 hLogoAxis = axes( ... | |
49 'Units', 'normalized', ... | |
50 'Position', [0.05 0.82 0.90 0.14], ... | |
51 'Box', 'off', ... | |
52 'XColor', [0 0 0], ... | |
53 'YColor', [0 0 0], ... | |
54 'Visible', 'on'); | |
55 | |
56 load netlogo; % load image and colour map | |
57 colormap(netcmap(1:3,:)); % change colour map: don't need many entries | |
58 image(nlogo); % draw logo | |
59 axis('image'); % ensures pixels on axis are square | |
60 axis off; % turn axes off | |
61 | |
62 % Create static text | |
63 uicontrol(fig, ... | |
64 'Style', 'text', ... | |
65 'Units', 'normalized', ... | |
66 'BackgroundColor', [0.5 0.5 0.5], ... | |
67 'Position', [0.05 group1_top-0.1 0.90 0.08], ... | |
68 'String', 'Select demo to run:'); | |
69 | |
70 % First row text offset | |
71 tRow1Offset = 0.14; | |
72 % Offset between text and button | |
73 TBoffset = 0.07; | |
74 % First row button offset | |
75 bRow1Offset = tRow1Offset+TBoffset; | |
76 % ONE text | |
77 uicontrol(fig, ... | |
78 'Style', 'text', ... | |
79 'Units', 'normalized', ... | |
80 'BackgroundColor', [0.5 0.5 0.5], ... | |
81 'Position', [0.08 group1_top-tRow1Offset 0.36 0.05], ... | |
82 'String', 'Regression'); | |
83 | |
84 popup1str(1) = {'Select Option'}; | |
85 popup1str(2) = {'Multi-Layer Perceptron'}; | |
86 popup1str(3) = {'Radial Basis Function'}; | |
87 popup1str(4) = {'Mixture Density Network'}; | |
88 % ONE popup | |
89 hPop1 = uicontrol(fig, ... | |
90 'Style','popup', ... | |
91 'Units','normalized', ... | |
92 'String', popup1str, ... | |
93 'Position', [0.08 group1_top-bRow1Offset 0.36 0.08], ... | |
94 'BackgroundColor', [0.7 0.7 0.7], ... | |
95 'Callback', 'demnlab popup1'); | |
96 | |
97 % TWO text | |
98 uicontrol(fig, ... | |
99 'Style', 'text', ... | |
100 'Units', 'normalized', ... | |
101 'BackgroundColor', [0.5 0.5 0.5], ... | |
102 'Position', [0.56 group1_top-tRow1Offset 0.36 0.05], ... | |
103 'String', 'Classification'); | |
104 | |
105 popup2str(1) = popup1str(1); | |
106 popup2str(2) = {'Generalised Linear Model (2 class)'}; | |
107 popup2str(3) = {'Generalised Linear Model (3 class)'}; | |
108 popup2str(4) = {'Multi-Layer Perceptron'}; | |
109 popup2str(5) = {'K nearest neighbour'}; | |
110 % TWO popup | |
111 hPop2 = uicontrol(fig, ... | |
112 'Style','popup', ... | |
113 'Units','normalized', ... | |
114 'String', popup2str, ... | |
115 'Position', [0.56 group1_top-bRow1Offset 0.36 0.08], ... | |
116 'BackgroundColor', [0.7 0.7 0.7], ... | |
117 'Callback', 'demnlab popup2'); | |
118 | |
119 tRow2Offset = 0.30; | |
120 bRow2Offset = tRow2Offset+TBoffset; | |
121 % THREE text | |
122 uicontrol(fig, ... | |
123 'Style', 'text', ... | |
124 'Units', 'normalized', ... | |
125 'BackgroundColor', [0.5 0.5 0.5], ... | |
126 'Position', [0.08 group1_top - tRow2Offset 0.36 0.05], ... | |
127 'String', 'Density Modelling and Clustering'); | |
128 | |
129 popup3str(1) = popup1str(1); | |
130 popup3str(2) = {'Gaussian Mixture (EM training)'}; | |
131 popup3str(3) = {'Gaussian Mixture (spherical)'}; | |
132 popup3str(4) = {'Gaussian Mixture (diagonal)'}; | |
133 popup3str(5) = {'Gaussian Mixture (full)'}; | |
134 popup3str(6) = {'Neuroscale'}; | |
135 popup3str(7) = {'GTM (EM training)'}; | |
136 popup3str(8) = {'GTM (visualisation)'}; | |
137 popup3str(9) = {'K-means clustering'}; | |
138 popup3str(10) = {'Self-Organising Map'}; | |
139 % TWO popup | |
140 % THREE popup | |
141 hPop3 = uicontrol(fig, ... | |
142 'Style','popup', ... | |
143 'Units','normalized', ... | |
144 'String', popup3str, ... | |
145 'Position', [0.08 group1_top - bRow2Offset 0.36 0.08], ... | |
146 'BackgroundColor', [0.7 0.7 0.7], ... | |
147 'Callback', 'demnlab popup3'); | |
148 | |
149 % FOUR text | |
150 uicontrol(fig, ... | |
151 'Style', 'text', ... | |
152 'Units', 'normalized', ... | |
153 'BackgroundColor', [0.5 0.5 0.5], ... | |
154 'Position', [0.56 group1_top - tRow2Offset 0.36 0.05], ... | |
155 'String', 'Bayesian Methods'); | |
156 | |
157 popup4str(1) = popup1str(1); | |
158 popup4str(2) = {'Sampling the MLP Prior'}; | |
159 popup4str(3) = {'Evidence Approximation for MLP'}; | |
160 popup4str(4) = {'Evidence Approximation for RBF'}; | |
161 popup4str(5) = {'Evidence Approximation in Classification'}; | |
162 popup4str(6) = {'ARD for MLP'}; | |
163 popup4str(7) = {'Sampling the GP Prior'}; | |
164 popup4str(8) = {'GPs for Regression'}; | |
165 popup4str(9) = {'ARD for GP'}; | |
166 % FOUR popup | |
167 hPop4 = uicontrol(fig, ... | |
168 'Style','popup', ... | |
169 'Units','normalized', ... | |
170 'String', popup4str, ... | |
171 'Position', [0.56 group1_top - bRow2Offset 0.36 0.08], ... | |
172 'BackgroundColor', [0.7 0.7 0.7], ... | |
173 'Callback', 'demnlab popup4'); | |
174 | |
175 | |
176 tRow3Offset = 0.45; | |
177 bRow3Offset = tRow3Offset+TBoffset; | |
178 % FIVE text | |
179 uicontrol(fig, ... | |
180 'Style', 'text', ... | |
181 'Units', 'normalized', ... | |
182 'BackgroundColor', [0.5 0.5 0.5], ... | |
183 'Position', [0.08 group1_top - tRow3Offset 0.36 0.05], ... | |
184 'String', 'Optimisation and Visualisation'); | |
185 | |
186 popup5str(1) = popup1str(1); | |
187 popup5str(2) = {'Algorithm Comparison'}; | |
188 popup5str(3) = {'On-line Gradient Descent'}; | |
189 popup5str(4) = {'Hinton Diagrams'}; | |
190 % FIVE popup | |
191 hPop5 = uicontrol(fig, ... | |
192 'Style','popup', ... | |
193 'Units','normalized', ... | |
194 'String',popup5str, ... | |
195 'Position', [0.08 group1_top - bRow3Offset 0.36 0.08], ... | |
196 'BackgroundColor', [0.7 0.7 0.7], ... | |
197 'Callback', 'demnlab popup5'); | |
198 | |
199 % SIX text | |
200 uicontrol(fig, ... | |
201 'Style', 'text', ... | |
202 'Units', 'normalized', ... | |
203 'BackgroundColor', [0.5 0.5 0.5], ... | |
204 'Position', [0.56 group1_top - tRow3Offset 0.36 0.05], ... | |
205 'String', 'Sampling'); | |
206 | |
207 popup6str(1) = popup1str(1); | |
208 popup6str(2) = {'Sampling a Gaussian'}; | |
209 popup6str(3) = {'MCMC sampling (Metropolis)'}; | |
210 popup6str(4) = {'Hybrid MC (Gaussian mixture)'}; | |
211 popup6str(5) = {'Hybrid MC for MLP I'}; | |
212 popup6str(6) = {'Hybrid MC for MLP II'}; | |
213 % SIX popup | |
214 hPop6 = uicontrol(fig, ... | |
215 'Style','popup', ... | |
216 'Units','normalized', ... | |
217 'String', popup6str, ... | |
218 'Position', [0.56 group1_top - bRow3Offset 0.36 0.08], ... | |
219 'BackgroundColor', [0.7 0.7 0.7], ... | |
220 'Callback', 'demnlab popup6'); | |
221 | |
222 | |
223 % Create HELP button | |
224 uicontrol(fig, ... | |
225 'Units', 'normalized', ... | |
226 'Position' , [0.05 group2_bot+0.02 0.40 0.08], ... | |
227 'String', 'Help', ... | |
228 'Callback', 'demnlab help'); | |
229 | |
230 % Create CLOSE button | |
231 uicontrol(fig, ... | |
232 'Units', 'normalized', ... | |
233 'Position' , [0.55 group2_bot+0.02 0.40 0.08], ... | |
234 'String', 'Close', ... | |
235 'Callback', 'close(gcf)'); | |
236 | |
237 hndlList=[fig hPop1 hPop2 hPop3 hPop4 hPop5 hPop6]; | |
238 set(fig, 'UserData', hndlList); | |
239 set(fig, 'HandleVisibility', 'callback'); | |
240 | |
241 elseif strcmp(action, 'popup1'), | |
242 | |
243 hndlList=get(gcf,'UserData'); | |
244 hPop = hndlList(2); | |
245 | |
246 selected = get(hPop, 'Val'); | |
247 set(hPop, 'Val', [1]); | |
248 | |
249 switch selected | |
250 case 2 | |
251 demmlp1; | |
252 case 3 | |
253 demrbf1; | |
254 case 4 | |
255 demmdn1; | |
256 end; | |
257 | |
258 elseif strcmp(action,'popup2'), | |
259 | |
260 hndlList=get(gcf,'UserData'); | |
261 hPop = hndlList(3); | |
262 | |
263 selected = get(hPop, 'Val'); | |
264 set(hPop, 'Val', [1]); | |
265 | |
266 switch selected | |
267 case 2 | |
268 demglm1; | |
269 case 3 | |
270 demglm2; | |
271 case 4 | |
272 demmlp2; | |
273 case 5 | |
274 demknn1; | |
275 end | |
276 | |
277 elseif strcmp(action,'popup3'), | |
278 | |
279 hndlList=get(gcf,'UserData'); | |
280 hPop = hndlList(4); | |
281 | |
282 selected = get(hPop, 'Val'); | |
283 set(hPop, 'Val', [1]); | |
284 | |
285 switch selected | |
286 case 2 | |
287 demgmm1; | |
288 case 3 | |
289 demgmm2; | |
290 case 4 | |
291 demgmm3; | |
292 case 5 | |
293 demgmm4; | |
294 case 6 | |
295 demns1; | |
296 case 7 | |
297 demgtm1; | |
298 case 8 | |
299 demgtm2; | |
300 case 9 | |
301 demkmn1; | |
302 case 10 | |
303 demsom1; | |
304 end | |
305 | |
306 elseif strcmp(action,'popup4'), | |
307 | |
308 hndlList=get(gcf,'UserData'); | |
309 hPop = hndlList(5); | |
310 | |
311 selected = get(hPop, 'Val'); | |
312 set(hPop, 'Val', [1]); | |
313 | |
314 switch selected | |
315 case 2 | |
316 demprior; | |
317 case 3 | |
318 demev1; | |
319 case 4 | |
320 demev3; | |
321 case 5 | |
322 demev2; | |
323 case 6 | |
324 demard; | |
325 case 7 | |
326 demprgp; | |
327 case 8 | |
328 demgp; | |
329 case 9 | |
330 demgpard; | |
331 end | |
332 | |
333 elseif strcmp(action,'popup5'), | |
334 | |
335 hndlList=get(gcf,'UserData'); | |
336 hPop = hndlList(6); | |
337 | |
338 selected = get(hPop, 'Val'); | |
339 set(hPop, 'Val', [1]); | |
340 | |
341 switch selected | |
342 case 2 | |
343 demopt1; | |
344 case 3 | |
345 demolgd1; | |
346 case 4 | |
347 demhint; | |
348 end | |
349 | |
350 | |
351 elseif strcmp(action,'popup6'), | |
352 | |
353 hndlList=get(gcf,'UserData'); | |
354 hPop = hndlList(7); | |
355 | |
356 selected = get(hPop, 'Val'); | |
357 set(hPop, 'Val', [1]); | |
358 | |
359 switch selected | |
360 case 2 | |
361 demgauss; | |
362 case 3 | |
363 demmet1; | |
364 case 4 | |
365 demhmc1; | |
366 case 5 | |
367 demhmc2; | |
368 case 6 | |
369 demhmc3; | |
370 end | |
371 | |
372 elseif strcmp(action, 'help'), | |
373 | |
374 helpStr = {'To run a demo, press the appropriate button.'; ... | |
375 'Instructions and information will appear in the Matlab';... | |
376 'command window.'}; | |
377 | |
378 hHelpDlg = helpdlg(helpStr, 'Netlab Demo Help'); | |
379 | |
380 end; |