function neural_network_test ( )

%*****************************************************************************80
%
%% neural_network_test() uses back propagation to train a network.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    23 July 2022
%
%  Author:
%
%    Catherine Higham, Desmond Higham.
%    Modifications by John Burkardt.
%
%  Reference:
%
%    Catherine Higham, Desmond Higham,
%    Deep Learning: An introduction for applied mathematicians,
%    SIAM Review,
%    Volume 61, Number 4, pages 860-891,
%    November 2019.
%
  addpath ( '../neural_network' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'neural_network_test():\n' );
  fprintf ( 1, '  Demonstrate back propagation.\n' );
%
%  Initialize the random number generator.
%
  rng ( 'shuffle' );
%
%  Set the learning rate.
%
  eta = 0.05;
  fprintf ( 1, '  Using learning rate eta = %g\n', eta );
%
%  Set the number of iterations.
%
  it_num = 1000000;
  fprintf ( 1, '  Number of iterations = %d\n', it_num );
%
%  Run the code.
%
  cost = neural_network ( eta, it_num );
%
%  Plot the cost over the iteration.
%
  cost_plot ( cost );
%
%  Report the change in cost.
%
  fprintf ( 1, '  Initial cost = %g\n', cost(1) );
  fprintf ( 1, '  Final cost   = %g\n', cost(end) );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'neural_network_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  timestamp ( )
  rmpath ( '../neural_network' );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

