void main() { NET Net; BOOL Stop; REAL MinTestError; InitializeRandoms(); GenerateNetwork(&Net); RandomWeights(&Net); InitializeApplication(&Net); Stop = FALSE; MinTestError = MAX_REAL; do { TrainNet(&Net, 10); TestNet(&Net); if (TestError < MinTestError) { fprintf(f, " - saving Weights ..."); MinTestError = TestError; SaveWeights(&Net); } else if (TestError > 1.2 * MinTestError) { fprintf(f, " - stopping Training and restoring Weights ..."); Stop = TRUE; RestoreWeights(&Net); } } while (NOT Stop); TestNet(&Net); EvaluateNet(&Net); FinalizeApplication(&Net); }
void main() { NET Net; int ct = 0; InitializeRandoms(); GenerateNetwork(&Net); RandomWeights(&Net); InitializeApplication(&Net); do { TrainNet(&Net, 10); if (ct % 10 == 0) { fprintf(f, "Epoch = %d\n",ct); EvaluateNet(&Net); } ct++; } while (ct<MAXCT); fprintf(f, "\n"); fprintf(f, "Finial Epoch:\n"); EvaluateNet(&Net); FinalizeApplication(&Net); }
/* * Class: klb_android_GameEngine_PFInterface * Method: finishGame * Signature: ()V */ JNIEXPORT void JNICALL JAVA_FUNC(finishGame) (JNIEnv *env, jobject obj) { if( LoadApplication ){ PROC_FUNC(finishGame)( env, obj ); FinalizeApplication(); } }
void main() { NET Net; InitializeRandoms(); GenerateNetwork(&Net); RandomWeights(&Net); InitializeApplication(&Net); TrainNet(&Net); WriteNet(&Net); FinalizeApplication(&Net); }
void main() { NET Net; REAL Error; BOOL Stop; INT n,m; InitializeRandoms(); GenerateNetwork(&Net); RandomWeights(&Net); InitializeApplication(&Net); do { Error = 0; Stop = TRUE; for (n=0; n<NUM_DATA; n++) { SimulateNet(&Net, Input[n], Output[n], FALSE, FALSE); Error = MAX(Error, Net.Error); Stop = Stop AND (Net.Error < Net.Epsilon); } Error = MAX(Error, Net.Epsilon); printf("Training %0.0f%% completed ...\n", (Net.Epsilon / Error) * 100); if (NOT Stop) { for (m=0; m<10*NUM_DATA; m++) { n = RandomEqualINT(0, NUM_DATA-1); SimulateNet(&Net, Input[n], Output[n], TRUE, FALSE); } } } while (NOT Stop); for (n=0; n<NUM_DATA; n++) { SimulateNet(&Net, Input[n], Output[n], FALSE, TRUE); } FinalizeApplication(&Net); }