def task(self):
     listInst = dtree.load_csv_dataset(datadir("data.csv"))
     br = dtree.boost(listInst)
     return {"chart": {"defaultSeriesType": "line"},
             "title": {"text": "Boosting Classifier Weights"},
             "xAxis": {"title": {"text": "Classifier Number"}},
             "series": [{"name": "Classifier Weights",
                         "data": br.listDblCferWeight}]}
 def test_boost(self):
     listAttr = randlist(0, 5, 10)
     listInst = [dtree.Instance(listAttr, True) for _ in xrange(100)]
     listInstFalse = random.sample(listInst, 10)
     for inst in listInstFalse:
         inst.fLabel = False
     listInstCopy = [inst.copy() for inst in listInst]
     br = dtree.boost(listInstCopy)
     dblWeightExpected = dtree.classifier_weight(0.1)
     self.assertAlmostEqual(br.listDblCferWeight[0], dblWeightExpected)
 def test_boost_maxrounds(self):
     cRound = random.randint(2, 25)
     listInst = build_consistent_generator()(100)
     br = dtree.boost(listInst, cMaxRounds=cRound)
     self.assertTrue(len(br.listCfer) <= cRound)
     self.assertTrue(len(br.listDblCferWeight) <= cRound)
Exemple #4
0
def dt_build_model(listInst, cRounds):
    """Build boosted committee from instances"""
    return dtree.boost(listInst, cRounds)