diff options
| author | ziejd2 | 2018-03-14 23:23:33 -0500 |
|---|---|---|
| committer | GitHub | 2018-03-14 23:23:33 -0500 |
| commit | 1ff6baa44e22b91eefb48aea6f3befa078c0489b (patch) | |
| tree | e0fd79d2e32fd2aedda2eadaed0f19af3514c520 /sourcecodes/bnt-master/netlab3.3/hinton.m | |
| parent | 6882395afdadf4e982b25b5215071a0932730950 (diff) | |
| parent | c80226899f5cdd9f11c163817d59445213f5bef0 (diff) | |
| download | BNW-1ff6baa44e22b91eefb48aea6f3befa078c0489b.tar.gz | |
Merge pull request #1 from ziejd2/octave_php_separate
Octave php separate
Diffstat (limited to 'sourcecodes/bnt-master/netlab3.3/hinton.m')
| -rw-r--r-- | sourcecodes/bnt-master/netlab3.3/hinton.m | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/netlab3.3/hinton.m b/sourcecodes/bnt-master/netlab3.3/hinton.m new file mode 100644 index 00000000..c2c4b2be --- /dev/null +++ b/sourcecodes/bnt-master/netlab3.3/hinton.m @@ -0,0 +1,57 @@ +function h = hinton(w); +%HINTON Plot Hinton diagram for a weight matrix. +% +% Description +% +% HINTON(W) takes a matrix W and plots the Hinton diagram. +% +% H = HINTON(NET) also returns the figure handle H which can be used, +% for instance, to delete the figure when it is no longer needed. +% +% To print the figure correctly in black and white, you should call +% SET(H, 'INVERTHARDCOPY', 'OFF') before printing. +% +% See also +% DEMHINT, HINTMAT, MLPHINT +% + +% Copyright (c) Ian T Nabney (1996-2001) + +% Set scale to be up to 0.9 of maximum absolute weight value, where scale +% defined so that area of box proportional to weight value. + +% Use no more than 640x480 pixels +xmax = 640; ymax = 480; + +% Offset bottom left hand corner +x01 = 40; y01 = 40; +x02 = 80; y02 = 80; + +% Need to allow 5 pixels border for window frame: but 30 at top +border = 5; +top_border = 30; + +ymax = ymax - top_border; +xmax = xmax - border; + +% First layer + +[xvals, yvals, color] = hintmat(w); +% Try to preserve aspect ratio approximately +if (8*size(w, 1) < 6*size(w, 2)) + delx = xmax; dely = xmax*size(w, 1)/(size(w, 2)); +else + delx = ymax*size(w, 2)/size(w, 1); dely = ymax; +end + +h = figure('Color', [0.5 0.5 0.5], ... + 'Name', 'Hinton diagram', ... + 'NumberTitle', 'off', ... + 'Colormap', [0 0 0; 1 1 1], ... + 'Units', 'pixels', ... + 'Position', [x01 y01 delx dely]); +set(gca, 'Visible', 'off', 'Position', [0 0 1 1]); +hold on +patch(xvals', yvals', color', 'Edgecolor', 'none'); +axis equal; + |
