def kfcvtwcnb(mi, k=10): correct = [] tested = [] c = 0 t = 0 for i in range(k): #mark_test_set(mi, k, i) MessageFeatures.test_fold = i MessageFeatures.folds = k bn = Twncb(mi) bn.train() bn.test_marked() c = bn.correct t = bn.t correct.append(c) tested.append(t) print (1.0*sum(correct)/sum(correct))
def twcnb(mi): classifier = Twncb(mi) classifier.train() classifier.test()