ch_bprms.c
来自「NIST Handwriting OCR Testbed」· C语言 代码 · 共 432 行 · 第 1/2 页
C
432 行
} else mmm_gotten = FALSE; /* (End of those parameter checks that should be done regardless of whether this is a training or testing run.) */ if(!parms->train_or_test.ssl.set) { *cb_any_warnings = is_w_get(); *cb_any_errors = is_e_get(); if(!parms->seed.ssl.set) uni(12345); return; } if(parms->train_or_test.val == TRAIN) { /* Check that all parms needed only for training have been set. Check that any additional parms required as a result of the settings of these mandatory parms (e.g., temperature, if pruning is to be done), are also set. Warn if irrelevant parms, or parms that will be ignored, have been set. */ if(!parms->boltzmann.ssl.set_tried) neverset("boltzmann"); if(parms->boltzmann.ssl.set) { if(parms->boltzmann.val == NO_PRUNE) { if(parms->temperature.ssl.set_tried) { sprintf(str, "boltzmann is set to no_prune \(line %d), but temperature is set (line %d); it will not be used", parms->boltzmann.ssl.linenum, parms->temperature.ssl.linenum); eb_cat_w(str); } if(!parms->scg_earlystop_pct.ssl.set_tried) { sprintf(str, "boltzmann is set to no_prune \(line %d), causing hybrid SCG/LBFGS training, but \scg_earlystop_pct is never set", parms->boltzmann.ssl.linenum); eb_cat_e(str); } if(!parms->lbfgs_gtol.ssl.set_tried) { sprintf(str, "boltzmann is set to no_prune \(line %d), causing hybrid SCG/LBFGS training, but \lbfgs_gtol is never set", parms->boltzmann.ssl.linenum); eb_cat_e(str); } if(!parms->lbfgs_mem.ssl.set_tried) { sprintf(str, "boltzmann is set to no_prune \(line %d), causing hybrid SCG/LBFGS training, but \lbfgs_mem is never set", parms->boltzmann.ssl.linenum); eb_cat_e(str); } } else { /* parms->boltzmann.val != NO_PRUNE */ if(!parms->temperature.ssl.set_tried) { sprintf(str, "boltzmann is set to %s (line %d), but \temperature is never set", (parms->boltzmann.val == ABS_PRUNE ? "abs_prune" : "square_prune"), parms->boltzmann.ssl.linenum); eb_cat_e(str); } if(parms->scg_earlystop_pct.ssl.set_tried) { sprintf(str, "boltzmann is set to %s (line %d), \causing SCG training, but scg_earlystop_pct is set (line %d); it \will not be used", (parms->boltzmann.val == ABS_PRUNE ? "abs_prune" : "square_prune"), parms->boltzmann.ssl.linenum, parms->scg_earlystop_pct.ssl.linenum); eb_cat_w(str); } if(parms->lbfgs_gtol.ssl.set_tried) { sprintf(str, "boltzmann is set to %s (line %d), \causing SCG training, but lbfgs_gtol is set (line %d); it \will not be used", (parms->boltzmann.val == ABS_PRUNE ? "abs_prune" : "square_prune"), parms->boltzmann.ssl.linenum, parms->lbfgs_gtol.ssl.linenum); eb_cat_w(str); } if(parms->lbfgs_mem.ssl.set_tried) { sprintf(str, "boltzmann is set to %s (line %d), \causing SCG training, but lbfgs_mem is set (line %d); it \will not be used", (parms->boltzmann.val == ABS_PRUNE ? "abs_prune" : "square_prune"), parms->boltzmann.ssl.linenum, parms->lbfgs_mem.ssl.linenum); eb_cat_w(str); } } } if(parms->wts_infile.ssl.set_tried) { if(parms->seed.ssl.set_tried) { sprintf(str, "wts_infile is set (line %d), but seed is set \(line %d); weights will be read from the file, and seed will not be \used", parms->wts_infile.ssl.linenum, parms->seed.ssl.linenum); eb_cat_w(str); } csopiwh(parms); } else { if(!parms->seed.ssl.set_tried) eb_cat_e("wts_infile is not set, meaning that random initial \weights should be generated, but seed is never set"); if(!parms->purpose.ssl.set_tried) eb_cat_e("wts_infile is not set, so purpose must be set in \specfile, but it is not"); if(!parms->ninps.ssl.set_tried) eb_cat_e("wts_infile is not set, so ninps must be set in \specfile, but it is not"); if(!parms->nhids.ssl.set_tried) eb_cat_e("wts_infile is not set, so nhids must be set in \specfile, but it is not"); if(!parms->nouts.ssl.set_tried) eb_cat_e("wts_infile is not set, so nouts must be set in \specfile, but it is not"); if(!parms->acfunc_hids.ssl.set_tried) eb_cat_e("wts_infile is not set, so acfunc_hids must be set \in specfile, but it is not"); if(!parms->acfunc_outs.ssl.set_tried) eb_cat_e("wts_infile is not set, so acfunc_outs must be set \in specfile, but it is not"); } if(!parms->wts_outfile.ssl.set_tried) neverset("wts_outfile"); if(!parms->niter_max.ssl.set_tried) neverset("niter_max"); if(!parms->egoal.ssl.set_tried) neverset("egoal"); if(!parms->gwgoal.ssl.set_tried) neverset("gwgoal"); if(!parms->nfreq.ssl.set_tried) neverset("nfreq"); if(!parms->errdel.ssl.set_tried) neverset("errdel"); if(!parms->nokdel.ssl.set_tried) neverset("nokdel"); if(mmm_gotten && !parms->wts_infile.ssl.set_tried) { if(parms->ninps.ssl.set && parms->ninps.val > minps) { sprintf(str, "ninps value, %d, set in line %d, is larger \than minps (number of elements in each feature vector) value, %d, \of patterns file %s", parms->ninps.val, parms->ninps.ssl.linenum, minps, parms->patterns_infile.val); eb_cat_e(str); } if(parms->nouts.ssl.set && parms->nouts.val != mouts) { sprintf(str, "nouts value, %d, set in line %d, does not \equal mouts (number of elements in each target vector, or number of \classes) value, %d, of patterns file %s", parms->nouts.val, parms->nouts.ssl.linenum, mouts, parms->patterns_infile.val); eb_cat_e(str); } } } /* parms->train_or_test.val == TRAIN */ else { /* parms->train_or_test.val == TEST */ /* Warn if irrelevant parms, or parms that will be ignored, have been set. Check that the parm needed only for testing, namely wts_infile, has been set. */ csopiwh(parms); if(parms->boltzmann.ssl.set_tried) { sprintf(str, "boltzmann has been set (line %d); its \value will not be used", parms->boltzmann.ssl.linenum); eb_cat_w(str); } if(parms->temperature.ssl.set_tried) { sprintf(str, "temperature has been set (line %d); its value \will not be used", parms->temperature.ssl.linenum); eb_cat_w(str); } if(!parms->wts_infile.ssl.set_tried) neverset("wts_infile"); if(parms->wts_outfile.ssl.set_tried) { sprintf(str, "wts_outfile has been set (line %d); there will \be no writing to that file", parms->wts_outfile.ssl.linenum); eb_cat_w(str); } if(parms->seed.ssl.set_tried) { sprintf(str, "seed has been set (line %d); its value will \not be used", parms->seed.ssl.linenum); eb_cat_w(str); } if(parms->niter_max.ssl.set_tried) tsp_w("niter_max", parms->niter_max.ssl.linenum); if(parms->egoal.ssl.set_tried) tsp_w("egoal", parms->egoal.ssl.linenum); if(parms->gwgoal.ssl.set_tried) tsp_w("gwgoal", parms->gwgoal.ssl.linenum); if(parms->nfreq.ssl.set_tried) tsp_w("nfreq", parms->nfreq.ssl.linenum); if(parms->errdel.ssl.set_tried) tsp_w("errdel", parms->errdel.ssl.linenum); if(parms->nokdel.ssl.set_tried) tsp_w("nokdel", parms->nokdel.ssl.linenum); } /* parms->train_or_test.val == TEST */ *cb_any_warnings = is_w_get(); *cb_any_errors = is_e_get(); if(!parms->seed.ssl.set) uni(12345);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?