127 tprintf(
"YMiddle: Proto=%g, Delta=%g, Var=%g, Dist=%g\n",
134 tprintf(
"Height: Proto=%g, Delta=%g, Var=%g, Dist=%g\n",
141 tprintf(
"Width: Proto=%g, Delta=%g, Var=%g\n",
149 tprintf(
"Total Dist=%g, scaled=%g, sigmoid=%g, penalty=%g\n",
154 if (Match < BestMatch)
188 NormAdj = NormAdj * NormAdj * NormAdj;
190 NormAdj = NormAdj * NormAdj;
193 return (1.0 / (1.0 + NormAdj));
217 for (i = 0, TotalMatch = 0.0; i < NumParams; i++) {
218 ParamMatch = (Feature->
Params[i] -
Mean(Proto, i)) /
221 fprintf (File,
" %6.1f", ParamMatch);
224 TotalMatch += ParamMatch * ParamMatch;
226 fprintf (File,
" --> %6.1f (%4.2f)\n",
257 for (i = 0; i < NormProtos->
NumProtos; i++)
265 while ((end_offset < 0 || ftell(File) < end_offset) &&
266 tfscanf(File,
"%s %d", unichar, &NumProtos) == 2) {
269 Protos = NormProtos->
Protos[unichar_id];
270 for (i = 0; i < NumProtos; i++)
273 NormProtos->
Protos[unichar_id] = Protos;
275 cprintf(
"Error: unichar %s in normproto file is not in unichar set.\n",
277 for (i = 0; i < NumProtos; i++)
const UNICHAR_ID unichar_to_id(const char *const unichar_repr) const
#define double_VAR(name, val, comment)
double classify_norm_adj_midpoint
int tfscanf(FILE *stream, const char *format,...)
uinT16 ReadSampleSize(FILE *File)
void PrintNormMatch(FILE *File, int NumParams, PROTOTYPE *Proto, FEATURE Feature)
const char *const id_to_unichar(UNICHAR_ID id) const
void FreeProtoList(LIST *ProtoList)
LIST push_last(LIST list, void *item)
void SkipNewline(FILE *file)
NORM_PROTOS * ReadNormProtos(FILE *File)
FLOAT32 ComputeNormMatch(CLASS_ID ClassId, const FEATURE_STRUCT &feature, BOOL8 DebugMatch)
FLOAT32 Mean(PROTOTYPE *Proto, uinT16 Dimension)
double NormEvidenceOf(register double NormAdj)
bool contains_unichar(const char *const unichar_repr) const
void cprintf(const char *format,...)
void FreePrototype(void *arg)
const double kWidthErrorWeighting
PARAM_DESC * ReadParamDesc(FILE *File, uinT16 N)
FLOAT32 StandardDeviation(PROTOTYPE *Proto, uinT16 Dimension)
double classify_norm_adj_curl
NORM_PROTOS * ReadNormProtos(FILE *File, inT64 end_offset)
PROTOTYPE * ReadPrototype(FILE *File, uinT16 N)