
/********************************************************/
/**
   //  Author  :   Keith A. Pray
   //  Date    :   Spetember 2000 (created)
   //  For     :   Machine Learning CS 539
   //
   //******************************************************/
  
  /* The main purpose of this is to test the neural network
     stuff */
  
#include <stdio.h>
#include <backprop.h>
#include <math.h>
  
#define ABS(x)          (((x) > 0.0) ? (x) : (-(x)))
  
  
  void bpnn_display ( net )
     BPNN *net;
{
  int i, j = 0;
  
  printf ( "The input weights:\n" );
  
  for ( i = 0; i <= net->input_n; i++ )
  {
    for ( j = 0; j <= net->hidden_n; j++ )
    {
      printf ( "%f \t", net->input_weights[i][j] );
    }
    printf ("\n" );
  }
  
  printf ( "\nThe hidden weights:\n" );
  
  for ( i = 0; i <= net->hidden_n; i++ )
  {
    for ( j = 0; j <= net->output_n; j++ )
    {
      printf ( "%f \t", net->hidden_weights[i][j] );
    }
    printf ("\n" );
  }
}

void main ( argc, argv )
     int argc;
     char *argv[];
{
  double x, d = 0;
  BPNN *net = NULL;
  
  x = atof ( argv[1] );
  
  printf ( "%f\n %s\n", x, argv[1] );
  
  d = ABS ( x );
  
  printf ( "ABS ( %f ) = %f \n", x, d );
  
  printf ( "Try making this Back Propagation Neural Network thing\n");
  printf ( "Gonna make 3 in, 2 hidden, 3 out\n" );
  
  net = bpnn_create ( 3, 2, 3 );
  
  /** did it work? */
  if ( net == NULL )
  {
    printf ( "It no work, you so STUPID!\n" );
  }
  else
  {
    printf ( "It worked! You still so STUPID!\n" );
  }
  
  /** print out our net **/
  bpnn_display ( net );
  
  /** all done, remember to free the memory, Java has spoiled you **/
  bpnn_free ( net );
}

