[Spambayes-checkins] spambayes cmp.py,1.2,1.3
Neil Schemenauer
nascheme@users.sourceforge.net
Sun, 08 Sep 2002 10:10:06 -0700
Update of /cvsroot/spambayes/spambayes
In directory usw-pr-cvs1:/tmp/cvs-serv10946
Modified Files:
cmp.py
Log Message:
make work for NSETS != 5
Index: cmp.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/cmp.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** cmp.py 6 Sep 2002 04:25:45 -0000 1.2
--- cmp.py 8 Sep 2002 17:10:03 -0000 1.3
***************
*** 10,15 ****
f1n, f2n = sys.argv[1:3]
- NSETS = 5
-
# Return
# (list of all f-p rates,
--- 10,13 ----
***************
*** 21,29 ****
fns = []
fps = []
! for block in range(NSETS):
! # Skip, e.g.,
! # Training on Data/Ham/Set1 & Data/Spam/Set1 ... 4000 hams & 2750 spams
! f.readline()
! for inner in range(NSETS - 1):
# A line with an f-p rate and an f-n rate.
p, n = map(float, f.readline().split())
--- 19,27 ----
fns = []
fps = []
! while 1:
! line = f.readline()
! if line.startswith('total'):
! break
! if not line.startswith('Training'):
# A line with an f-p rate and an f-n rate.
p, n = map(float, f.readline().split())
***************
*** 33,37 ****
# "total false pos 8 0.04"
# "total false neg 249 1.81090909091"
! fptot = int(f.readline().split()[-2])
fntot = int(f.readline().split()[-2])
return fps, fns, fptot, fntot
--- 31,35 ----
# "total false pos 8 0.04"
# "total false neg 249 1.81090909091"
! fptot = int(line.split()[-2])
fntot = int(f.readline().split()[-2])
return fps, fns, fptot, fntot