[Spambayes-checkins] spambayes/spambayes Stats.py,1.18,1.19
Kenny Pitt
kpitt at users.sourceforge.net
Wed Dec 20 23:52:35 CET 2006
- Previous message: [Spambayes-checkins] spambayes/spambayes tokenizer.py,1.45,1.46
- Next message: [Spambayes-checkins] website applications.ht, 1.31, 1.32 docs.ht, 1.20, 1.21 faq.txt, 1.91, 1.92 unix.ht, 1.11, 1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv28508/spambayes
Modified Files:
Stats.py
Log Message:
Delay calculation of persistent stats until they are needed for a GetStats() call.
Index: Stats.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/Stats.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** Stats.py 28 Nov 2005 10:50:56 -0000 1.18
--- Stats.py 20 Dec 2006 22:51:18 -0000 1.19
***************
*** 57,63 ****
# Reset session stats.
self.Reset()
! # Load persistent stats.
self.from_date = self.messageinfo_db.get_statistics_start_date()
! self.CalculatePersistentStats()
def Reset(self):
--- 57,63 ----
# Reset session stats.
self.Reset()
! # Initialize persistent stats.
self.from_date = self.messageinfo_db.get_statistics_start_date()
! self.persistentStatsCalculated = False
def Reset(self):
***************
*** 168,171 ****
--- 168,181 ----
totals["num_trained_spam"] += 1
+ # If we have already accumulated any session statistics then we need
+ # to subtract those from the totals to prevent double-counting.
+ totals["num_ham"] -= self.num_ham
+ totals["num_spam"] -= self.num_spam
+ totals["num_unsure"] -= self.num_unsure
+ totals["num_trained_ham"] -= self.num_trained_ham
+ totals["num_trained_ham_fp"] -= self.num_trained_ham_fp
+ totals["num_trained_spam"] -= self.num_trained_spam
+ totals["num_trained_spam_fn"] -= self.num_trained_spam_fn
+
def _CombineSessionAndTotal(self):
totals = self.totals
***************
*** 324,327 ****
--- 334,341 ----
data["num_trained_spam_fn"] = self.num_trained_spam_fn
else:
+ if not self.persistentStatsCalculated:
+ # Load persistent stats.
+ self.CalculatePersistentStats()
+ self.persistentStatsCalculated = True
data = self._CombineSessionAndTotal()
- Previous message: [Spambayes-checkins] spambayes/spambayes tokenizer.py,1.45,1.46
- Next message: [Spambayes-checkins] website applications.ht, 1.31, 1.32 docs.ht, 1.20, 1.21 faq.txt, 1.91, 1.92 unix.ht, 1.11, 1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Spambayes-checkins
mailing list