function slide=demorb3
% This is a slideshow file for use with playshow.m and makeshow.m
% To see it run, type 'playshow demorb3', 

% Copyright (c) 1992-1998 by The MathWorks, Inc.
% $Revision: 1.10 $  $Date: 1998/06/11 16:23:47 $

if nargout<1,
  playshow demorb3
else
  %========== Slide 1 ==========

  slide(1).code={
   'slideData=nnslides(''start'',slideData,''Underlapping Neurons'');' };
  slide(1).text={
   'NEWRB  - Creates a radial basis network.',
   'SIM  - Simulates a neural network.',
   '',
   'Using the above functions a radial basis network is trained to respond to specific inputs with target outputs.  However, because the spread of the radial basis neurons is too low, the network requires many neurons.',
   ''};

  %========== Slide 2 ==========

  slide(2).code={
   'slideData=nnslides(''axes'',slideData);',
   'P = -1:.1:1;',
   'T = [-.9602 -.5770 -.0729  .3771  .6405  .6600  .4609   .1336 -.2013 -.4344 -.5000 -.3930 -.1647  .0988  .3072  .3960  .3449  .1816 -.0312 -.2189 -.3201];',
   'plot(P,T,''+'');',
   'title(''Training Vectors'');',
   '  xlabel(''Input Vector P'');',
   '  ylabel(''Target Vector T'');' };
  slide(2).text={
   'Define 21 inputs P and associated targets T:',
   '>> P = -1:.1:1;',
   '>> T = [-.9602 -.5770 -.0729  .3771  .6405  .6600  .4609 ...',
   '          .1336 -.2013 -.4344 -.5000 -.3930 -.1647  .0988 ...',
   '          .3072  .3960  .3449  .1816 -.0312 -.2189 -.3201];',
   'Plot these 21 data points:',
   '>> plot(P,T,''+'');'};

  %========== Slide 3 ==========

  slide(3).code={
   'plot(P,T,''+'');',
   'title(''Training Vectors'');',
   'xlabel(''Input Vector P'');',
   'ylabel(''Target Vector T'');',
   'eg = 0.02; % sum-squared error goal.',
   'sc = .01;    % spread constant radial basis functions.',
   'net=newrb(P,T,eg,sc);',
   '' };
  slide(3).text={
   'The function NEWRB quickly creates a radial basis network which approximates the function defined by P and T.  In addition to the training set and targets, NEWRB takes two arguments:',
   '>> eg = 0.02;  % sum-squared error goal',
   '>> sc = .01;       % spread constant',
   'The spread of the radial basis neurons B is set to a very small number.',
   '>> net=newrb(P,T,eg,sc);'};

  %========== Slide 4 ==========

  slide(4).code={
   'X=-1:.01:1;',
   'Y=sim(net,X);',
   'hold on;',
   'plot(X,Y);',
   'hold off;',
   '' };
  slide(4).text={
   'To check that the network fits the function in a smooth way, define another set of test input vectors and simulate the network with these new inputs.',
   '>> X=-1:.01:1; Y=sim(net,X);',
   'Plot the results on the same graph as the training set:',
   '>> hold on;  plot(X,Y);  hold off;',
   'The test vectors reveal that the function has been overfit!  The network could have done better with a higher spread constant.',
   ''};
end