/* madaline.c Dwayne Phillips February 1992 The functions in this file implement the multiple adaptive linear element - Madaline - and the Madaline I learning law. Contents: display_2d_weights initialize_2d_weights madaline_output process_new_madaline train_the_madaline which_adaline */ #include #include #include /* void initialize_2d_weights(w, N, A) This function initializes the weights in th 2-dimensional weight vector. They are set to 0 2 4 6 0 2 4 6 ... */ initialize_2d_weights(w, N, A) long **w, N, A; { int i, j; for(i=0; i>"); for(j=0; j>"); gets(string); s = atoi(string); while(adjusting){ printf("\nwhile adjusting counter=%d", counter); counter++; adjusting = 0; fseek(inputs, 0L, SEEK_SET); for(i=0; i 299){ printf("\n\nTOO MUCH TRAINING - quiting"); adjusting = 0; } } /* ends while adjusting */ printf("\n\nwent through the training cycle %d times",counter); fclose(inputs); for(i=0; i minus) result = 1; } return(result); } /* ends madaline_output */ /* long which_adaline(target, outs, nets, A) Find the nets that has the smallest absolute value and the corresponding outs does not equal the target. */ which_adaline(target, outs, nets, A) long A, nets[], outs[], target; { int i; long result, sum; sum = 32000; for(i=0; i