def _Abcd(predicted, actual): predicted_txt = [] abcd = Abcd(db='Traing', rx='Testing') def isDef(x): return "Defective" if x > 0 else "Non-Defective" for data in predicted: predicted_txt +=[isDef(data)] for act, pre in zip(actual, predicted_txt): abcd.tell(act, pre) abcd.header() score = abcd.ask() # pdb.set_trace() return score
def _Abcd(testleaf, testdata, train): # train=[] test = [] abcd = Abcd(db='Traing', rx='Testing') def isDef(x): return "Defective" if x > The.option.threshold else "Non-Defective" for leaf, data in zip(testleaf, testdata): try: test += [isDef(leaf.score)] # test +=[isDef(majorityscore(data,leaf))] except Exception: # go to middle points # give the median of all rows in this point # pdb.set_trace() test += [isDef(leafscore(leaf))] continue for actual, predicted in zip(train, test): abcd.tell(actual, predicted) abcd.header() score = abcd.ask() return score