[spambayes-dev] [Spambayes] Bit of help on adding another statistic = )

Kenny Pitt kenny.pitt at gmail.com
Fri Oct 7 19:49:17 CEST 2005


FYI, if you are interested in modifying the spambayes source code then
your questions are probably best answered on the spambayes-dev list.

On 10/5/05, Erik Brown <kirebrow at yahoo.com> wrote:
> I tried to hack the Stats.py to display in larger font below the spam
> savings the total number of messages classified - the total number of
> messages classified incorrectly.

First off, using a different font for any of the elements in a Windows
dialog box requires a fare bit of low-level Windows programming. If
you can forego having your new statistics in a different font then the
task will be much easier. If you really want to go to the trouble,
though, you can find the dialog box code under the Outlook2000\dialogs
source directory.

> Just for kicks, I am providing a screen shot of what I'm trying to
> accomplish.  My current numbers after 860 messages classified is only 2
> misclassified.  So the number would be 100 - 0.2326 = 99.7674.

That is certainly a valid statistic, but may be misleading because it
doesn't take into account good messages that were removed from the
Inbox as unsure. These messages are considered "misclassified", but
you have to go looking for them somewhere other than your normal Inbox
folder.

> The number on the screen shot indicates what I am trying to do.  Can you
> provide me the code so that I can hack my local copy perhaps?

If you are already hacking Stats.py then you should already have all
the source code. Stats.py generates a string containing all the lines
of statistics, and the string is then displayed in the SpamBayes
Manager dialog in Outlook.

There are several functions that you would need to modify.
_CalculateAdditional computes the actual numeric percentages as
floating point values. _AddPercentStrings then adds displayable string
versions of each percentage value. Finally, GetStats formats all the
statistics into the strings that you see displayed. Each call to
push(...) in GetStats creates a new line in the stats display.

The percentage you are interested in can be computed as 100.0 *
(num_seen - num_incorrect) / num_seen.

--
Kenny Pitt


More information about the spambayes-dev mailing list