[cvs] bogofilter/src bogotune.c,1.12,1.13
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <re...@us...> - 2003-11-04 16:48:24
|
Update of /cvsroot/bogofilter/bogofilter/src In directory sc8-pr-cvs1:/tmp/cvs-serv1162 Modified Files: bogotune.c Log Message: Revise verbosity levels and debug printouts. Index: bogotune.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/bogotune.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- bogotune.c 31 Oct 2003 15:34:53 -0000 1.12 +++ bogotune.c 4 Nov 2003 16:48:21 -0000 1.13 @@ -38,14 +38,17 @@ #define LIST_COUNT 2000 #define TEST_COUNT 500 -#define SUMMARY 1 /* summarize main loop iterations */ -#define PARMS 2 /* print parameter sets (rs, md, rx) */ -#define SCORES 6 /* verbosity level for printing scores */ +enum e_verbosity { + SUMMARY = 1, /* summarize main loop iterations */ + PARMS = 2, /* print parameter sets (rs, md, rx) */ + SCORE_SUMMARY = 4, /* verbosity level for printing scores */ + SCORE_DETAIL /* verbosity level for printing scores */ +}; #define MOD(n,m) ((n) - ((int)((n)/(m)))*(m)) #define MIN(n) ((n)/60) -#define SECONDS(n) ((n) - MIN(n)*60) +#define SECONDS(n) ((n) - MIN(n)*60) #define ROUND(f) floor(f+0.5) @@ -241,7 +244,7 @@ uint i; uint count = 0; - if (verbose >= SCORES) + if (verbose >= SCORE_DETAIL) printf("ns:\n"); for (i=0; i < COUNTOF(ns_msglists->u.sets); i += 1) { @@ -251,6 +254,8 @@ wordhash_t *wh = item->wh; double score = (*method->compute_spamicity)(wh, NULL); results[count++] = score; + if (verbose >= SCORE_DETAIL) + printf("%6d %0.16f\n", count-1, score); } } @@ -264,6 +269,9 @@ uint i; uint count = 0; + if (verbose >= SCORE_DETAIL) + printf("sp:\n"); + for (i=0; i < COUNTOF(sp_msglists->u.sets); i += 1) { mlhead_t *list = sp_msglists->u.sets[i]; mlitem_t *item; @@ -271,6 +279,8 @@ wordhash_t *wh = item->wh; double score = (*method->compute_spamicity)(wh, NULL); results[count++] = score; + if (verbose >= SCORE_DETAIL) + printf("%6d %0.16f\n", count-1, score); } } @@ -828,6 +838,10 @@ printf("%sspam_cutoff=%5.3f\t# for %4.2f%% false positives; expect %4.2f%% false neg.\n", comment, cutoff, (mn != 1) ? 100.0 / mn : 100.0 * fp / ns_cnt, 100.0 * fn / sp_cnt); + + if (verbose >= PARMS) + printf("# mn %5d, ns_cnt %5d, sp_cnt %5d, fp %3d, fn %3d\n", + mn, ns_cnt, sp_cnt, fp, fn); comment = "#"; printed = true; |