Exemplo n.º 1
0
    def test_report_widgets_regression(self):
        rep = OWReport.get_instance()
        data = Table("housing")
        widgets = self.regr_widgets

        w = self.create_widget(OWRegressionTreeGraph)
        mod = TreeRegressionLearner(max_depth=3)(data)
        mod.instances = data
        w.ctree(mod)
        w.create_report_html()
        rep.make_report(w)

        self._create_report(widgets, rep, data)
Exemplo n.º 2
0
    def test_report_widgets_regression(self):
        rep = OWReport.get_instance()
        data = Table("housing")
        widgets = self.regr_widgets

        w = self.create_widget(OWRegressionTreeGraph)
        mod = TreeRegressionLearner(max_depth=3)(data)
        mod.instances = data
        w.ctree(mod)
        w.create_report_html()
        rep.make_report(w)

        self._create_report(widgets, rep, data)
Exemplo n.º 3
0
    def test_report_widgets_regression(self):
        app = QApplication(sys.argv)
        rep = OWReport.get_instance()
        data = Table("housing")
        widgets = self.regr_widgets

        w = OWRegressionTreeGraph()
        mod = TreeRegressionLearner(max_depth=3)(data)
        mod.instances = data
        w.ctree(mod)
        w.create_report_html()
        rep.make_report(w)

        self.assertEqual(len(widgets) + 1, 5)
        self._create_report(widgets, rep, data, app)
Exemplo n.º 4
0
    def test_report_widgets_regression(self):
        app = QApplication(sys.argv)
        rep = OWReport.get_instance()
        data = Table("housing")
        widgets = self.regr_widgets

        w = OWRegressionTreeGraph()
        mod = TreeRegressionLearner(max_depth=3)(data)
        mod.instances = data
        w.ctree(mod)
        w.create_report_html()
        rep.make_report(w)

        self.assertEqual(len(widgets) + 1, 5)
        self._create_report(widgets, rep, data, app)
Exemplo n.º 5
0
        self.scene.update()

    def send_report(self):
        if not self.tree:
            return
        self.report_items((
            ("Tree size", self.info.text()),
            ("Edge widths",
             ("Fixed", "Relative to root", "Relative to parent")[
                 self.line_width_method])))
        self.report_plot(self.scene)


if __name__ == "__main__":
    import sys
    from PyQt4.QtGui import QApplication
    from Orange.data import Table
    from Orange.regression.tree import TreeRegressionLearner

    a = QApplication(sys.argv)
    ow = OWRegressionTreeGraph()
    data = Table("housing")
    reg = TreeRegressionLearner(max_depth=5)(data)
    reg.instances = data

    ow.ctree(reg)
    ow.show()
    ow.raise_()
    a.exec_()
    ow.saveSettings()
Exemplo n.º 6
0
        all_instances = self.tree.n_node_samples[0]
        max_impurity = self.tree.impurity[0]
        for node in self.scene.nodes():
            li = [
                0.5,
                node.num_instances() / all_instances,
                node.impurity() / max_impurity
            ][self.color_index]
            node.backgroundBrush = QBrush(
                palette[self.color_index].light(180 - li * 150))
        self.scene.update()


if __name__ == "__main__":
    import sys
    from PyQt4.QtGui import QApplication
    from Orange.data import Table
    from Orange.regression.tree import TreeRegressionLearner

    a = QApplication(sys.argv)
    ow = OWRegressionTreeGraph()
    data = Table("housing")
    reg = TreeRegressionLearner(max_depth=5)(data)
    reg.instances = data

    ow.ctree(reg)
    ow.show()
    ow.raise_()
    a.exec_()
    ow.saveSettings()