From 2e74cd15ce23c08a4e942835c269968d305bee24 Mon Sep 17 00:00:00 2001 From: Gerolf Ziegenhain Date: Mon, 1 Sep 2008 18:45:17 +0200 Subject: [PATCH] . --- framework.py | 11 +++++------ statistic.py | 9 +++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/framework.py b/framework.py index 83cab13..1e24ae9 100644 --- a/framework.py +++ b/framework.py @@ -49,16 +49,16 @@ class Framework: self.method=method def FindAnyQuestion(self): - return r.sample(self.q.questions,1) + return r.sample(self.q.questions,1)[0] def FindNewQuestion(self): - return r.sample(self.s.newquestion,1) + return r.sample(self.s.newquestion,1)[0] def FindBadQuestion(self): - return r.sample(self.s.badquestion,1) + return r.sample(self.s.badquestion,1)[0] def FindGoodQuestion(self): - return r.sample(self.s.newquestion,1) + return r.sample(self.s.newquestion,1)[0] def Close(self): self.s.WriteFile() @@ -70,8 +70,7 @@ class Framework: if not (q[0] in self.s.badquestion): if not (q[0] in self.s.newquestion): self.s.newquestion.append (q[0]) - self.s.nnewquestion+=1 - print "total, good, bad, new:",self.q.nquestions,self.s.ngoodquestion,self.s.nbadquestion,self.s.nnewquestion + print "total, good, bad, new:",len(self.q.questions),len(self.s.goodquestion),len(self.s.badquestion),len(self.s.newquestion) def __init__(self,method="BadQuestions",catalog="TechnikA"): if catalog == "TechnikA": diff --git a/statistic.py b/statistic.py index 5da9d24..816a67b 100644 --- a/statistic.py +++ b/statistic.py @@ -99,9 +99,11 @@ class Statistic: self.statistics = [] self.ratio = .75 + self.mincorrect = 5. self.newquestion = [] self.goodquestion = [] self.badquestion = [] + norm = 1./self.mincorrect for q in self.root.getElementsByTagName("question"): id = q.getAttribute ("id") @@ -111,15 +113,18 @@ class Statistic: w = q.getAttribute ("w") if float(ws) > 0.: - rr = float(cs)/float(ws) + rr = 0. else: - rr = 0 + rr = float(cs)*norm if rr >= self.ratio: + print "Good", rr, "w",ws, "c",cs self.goodquestion.append (id) elif rr >= 0: + print "Bad",rr,"w",ws,"c",cs self.badquestion.append (id) else: # never reache # never reachedd + print "New",rr,"w",ws,"c",cs self.newquestion.append (id) answers = [] -- 2.11.4.GIT