Пример #1
0
    def task(self):
        listInstClean = dtree.load_csv_dataset(datadir("data.csv"))
        listInstNoisy = dtree.load_csv_dataset(datadir("noisy.dat"))
        cFold = 10
        listSeries = []
        for sLbl, fxn in [
            ("Unpruned", dtree.yield_cv_folds),
            ("Pruned", dtree.yield_cv_folds_with_validation),
            ("Boosted", dtree.yield_boosted_folds),
            ("Stumps", self.build_depth_yield(1)),
            ("Depth-2", self.build_depth_yield(2)),
        ]:
            try:
                fxnScore = lambda listInst: dtree.cv_score(fxn(listInst, cFold))
                listData = [fxnScore(listInstClean), fxnScore(listInstNoisy)]
                dictSeries = {"name": sLbl, "data": listData}
            except NotImplementedError:
                # we can forget about un-implemented functionality
                dictSeries = {"name": sLbl + " (not implemented)", "data": []}
            listSeries.append(dictSeries)

        return {
            "chart": {"defaultSeriesType": "column"},
            "title": {"text": "Clean vs. Noisy Classification"},
            "xAxis": {"categories": ["Clean", "Noisy"]},
            "yAxis": {"title": {"text": "Fraction Correct"}, "min": 0.0, "max": 1.0},
            "series": listSeries,
        }
 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}]}
Пример #3
0
    def task(self):
        listInstClean = dtree.load_csv_dataset(datadir("data.csv"))
        listInstNoisy = dtree.load_csv_dataset(datadir("noisy.dat"))
        cFold = 10
        listSeries = []
        for sLbl, fxn in [("Unpruned", dtree.yield_cv_folds),
                          ("Pruned", dtree.yield_cv_folds_with_validation),
                          ("Boosted", dtree.yield_boosted_folds),
                          ("Stumps", self.build_depth_yield(1)),
                          ("Depth-2", self.build_depth_yield(2))]:
            try:
                fxnScore = lambda listInst: dtree.cv_score(fxn(
                    listInst, cFold))
                listData = [fxnScore(listInstClean), fxnScore(listInstNoisy)]
                dictSeries = {"name": sLbl, "data": listData}
            except NotImplementedError:
                # we can forget about un-implemented functionality
                dictSeries = {"name": sLbl + " (not implemented)", "data": []}
            listSeries.append(dictSeries)

        return {
            "chart": {
                "defaultSeriesType": "column"
            },
            "title": {
                "text": "Clean vs. Noisy Classification"
            },
            "xAxis": {
                "categories": ["Clean", "Noisy"]
            },
            "yAxis": {
                "title": {
                    "text": "Fraction Correct"
                },
                "min": 0.0,
                "max": 1.0
            },
            "series": listSeries
        }
Пример #4
0
 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
         }]
     }
Пример #5
0
def get_noisy_insts():
    return dtree.load_csv_dataset(datadir("noisy.dat"))
Пример #6
0
def get_clean_insts():
    return dtree.load_csv_dataset(datadir("data.csv"))
Пример #7
0
 def task(self):
     listInst = dtree.load_csv_dataset(datadir("data.csv"))
     dt = dtree.build_tree(listInst, cMaxLevel=1)
     return serialize_tree(dt)
Пример #8
0
 def task(self):
     listInst = dtree.load_csv_dataset(datadir("data.csv"))
     dt = dtree.build_tree(listInst[:-10])
     dtree.prune_tree(dt, listInst[-10:])
     return serialize_tree(dt)
Пример #9
0
def get_noisy_insts():
    return dtree.load_csv_dataset(datadir("noisy.dat"))
Пример #10
0
def get_clean_insts():
    return dtree.load_csv_dataset(datadir("data.csv"))
Пример #11
0
 def task(self):
     listInst = dtree.load_csv_dataset(datadir("data.csv"))
     dt = dtree.build_tree(listInst, cMaxLevel=1)
     return serialize_tree(dt)
Пример #12
0
 def task(self):
     listInst = dtree.load_csv_dataset(datadir("data.csv"))
     dt = dtree.build_tree(listInst[:-10])
     dtree.prune_tree(dt, listInst[-10:])
     return serialize_tree(dt)