Daniel@0: function demhint(nin, nhidden, nout) Daniel@0: %DEMHINT Demonstration of Hinton diagram for 2-layer feed-forward network. Daniel@0: % Daniel@0: % Description Daniel@0: % Daniel@0: % DEMHINT plots a Hinton diagram for a 2-layer feedforward network with Daniel@0: % 5 inputs, 4 hidden units and 3 outputs. The weight vector is chosen Daniel@0: % from a Gaussian distribution as described under MLP. Daniel@0: % Daniel@0: % DEMHINT(NIN, NHIDDEN, NOUT) allows the user to specify the number of Daniel@0: % inputs, hidden units and outputs. Daniel@0: % Daniel@0: % See also Daniel@0: % HINTON, HINTMAT, MLP, MLPPAK, MLPUNPAK Daniel@0: % Daniel@0: Daniel@0: % Copyright (c) Ian T Nabney (1996-2001) Daniel@0: Daniel@0: if nargin < 1 nin = 5; end Daniel@0: if nargin < 2 nhidden = 7; end Daniel@0: if nargin < 3 nout = 3; end Daniel@0: Daniel@0: % Fix the seed for reproducible results Daniel@0: randn('state', 42); Daniel@0: clc Daniel@0: disp('This demonstration illustrates the plotting of Hinton diagrams') Daniel@0: disp('for Multi-Layer Perceptron networks.') Daniel@0: disp(' ') Daniel@0: disp('Press any key to continue.') Daniel@0: pause Daniel@0: net = mlp(nin, nhidden, nout, 'linear'); Daniel@0: Daniel@0: [h1, h2] = mlphint(net); Daniel@0: clc Daniel@0: disp('The MLP has been created with') Daniel@0: disp([' ' int2str(nin) ' inputs']) Daniel@0: disp([' ' int2str(nhidden) ' hidden units']) Daniel@0: disp([' ' int2str(nout) ' outputs']) Daniel@0: disp(' ') Daniel@0: disp('One figure is produced for each layer of weights.') Daniel@0: disp('For each layer the fan-in weights are arranged in rows for each unit.') Daniel@0: disp('The bias weight is separated from the rest by a red vertical line.') Daniel@0: disp('The area of each box is proportional to the weight value: positive') Daniel@0: disp('values are white, and negative are black.') Daniel@0: disp(' ') Daniel@0: disp('Press any key to exit.'); Daniel@0: pause; Daniel@0: delete(h1); Daniel@0: delete(h2);