/***************************************************************************** FILE : $Source: /projects/higgs1/SNNS/CVS/SNNS/tools/sources/isnns.c,v $ SHORTNAME : isnns SNNS VERSION : 4.2 PURPOSE : interactive control of SNNS NOTES : AUTHOR : original SNNS Version for V 3.0 by Michael Vogt DATE : 06.08.93 CHANGED BY : Michael Vogt SCCS VERSION : $Revision: 1.8 $ LAST CHANGE : $Date: 1998/03/19 12:25:45 $ Copyright (c) 1990-1995 SNNS Group, IPVR, Univ. Stuttgart, FRG Copyright (c) 1996-1998 SNNS Group, WSI, Univ. Tuebingen, FRG ******************************************************************************/ #include #include #include #include #include #include #ifdef HAVE_SYS_TIME_H #include #endif #include "glob_typ.h" /* SNNS-Kernel constants and data type definitions */ #include "kr_ui.h" /* SNNS-Kernel User-Interface Function Prototypes */ #include "isnns.h" int pat_set; int dummyarray[MAX_NO_OF_VAR_DIM]; /***************************************************************************** FUNCTION : errChk PURPOSE : Check for errors NOTES : RETURNS : UPDATE : ******************************************************************************/ static void errChk(int errNo) { if(errNo != KRERR_NO_ERROR) { fprintf(stderr, "isnns: %s\n", krui_error(errNo)); exit(1); } } /***************************************************************************** FUNCTION : read_activation PURPOSE : reads a number of float values from stream into an array RETURNS : NOTES : UPDATE : ******************************************************************************/ static void read_activation(FILE *stream, int n, float *field) { int i; for (i=0; i1) { patout = fopen(argv[1], "w"); if (patout == (FILE *) NULL) { fprintf(stderr, "isnns: can't open pattern file %s for writing\n", argv[1]); exit(1); } pattern = 1; } error = 0; do { fprintf(outfile, "%s", error ? "notok> " : "ok> "); fflush(outfile); error = 0; if (fscanf(infile, "%s", command) != 1) isnnscmd = C_QUIT; else isnnscmd = lookup_command(command); switch(isnnscmd) { case C_LOAD: fscanf(infile, "%s", netfilename); ret = krui_loadNet(netfilename, &netname); errChk(ret); if (verb) { fprintf(outfile,"Network '%s' loaded from file '%s'\n", netname, netfilename); } unit_n = krui_getNoOfUnits(); unit_input = 0; unit_output = 0; cu = krui_getFirstUnit(); for (i=0; i \n"); fprintf(stderr, "\t-> load this network\n"); fprintf(stderr, "save \n"); fprintf(stderr, "\t-> save this network\n"); fprintf(stderr, "prop ... \n"); fprintf(stderr, "\t-> propagate the given input pattern.\n"); fprintf(stderr, "\t-> returns the network output pattern.\n"); fprintf(stderr, "train ... \n"); fprintf(stderr, "\t-> performs one supervised training step with CURRENT\n"); fprintf(stderr, "\t-> input pattern and the GIVEN output pattern.\n"); fprintf(stderr, "\t-> is the learning rate.\n"); fprintf(stderr, "\t-> returns the error for this training step\n"); fprintf(stderr, "learn ... ... \n"); fprintf(stderr, "\t-> performs one supervised training step with GIVEN\n"); fprintf(stderr, "\t-> input pattern and the GIVEN output pattern.\n"); fprintf(stderr, "\t-> is the learning rate.\n"); fprintf(stderr, "\t-> returns the error for this training step\n"); fprintf(stderr, "quit\n"); fprintf(stderr, "\t-> quits isnns\n"); fprintf(stderr, "help\n"); fprintf(stderr, "\t-> this help\n"); break; default: /* never reached because of lookup_command */ break; } } while (!stop); fprintf(outfile, "%s", error ? "notok>\n" : "ok>\n"); fclose(outfile); fclose(infile); exit(error); }