コード例 #1
0
    def test_migration_2_3(self):
        # Obsolete, don't want to cause confusion by public import
        # pylint: disable=import-outside-toplevel
        from Orange.widgets.data.owdiscretize import \
            Default, EqualFreq, Leave, Custom, MDL, EqualWidth, DState
        context_values = {
            'saved_var_states': ({
                (2, 'age'):
                DState(method=Leave()),
                (2, 'rest SBP'):
                DState(method=EqualWidth(k=4)),
                (2, 'cholesterol'):
                DState(method=EqualFreq(k=6)),
                (4, 'max HR'):
                DState(method=Custom(points=(1.0, 2.0, 3.0))),
                (2, 'ST by exercise'):
                DState(method=MDL()),
                (2, 'major vessels colored'):
                DState(method=Default(method=EqualFreq(k=3)))
            }, -2),
            '__version__':
            2
        }

        settings = {
            'autosend': True,
            'controlAreaVisible': True,
            'default_cutpoints': (),
            'default_k': 3,
            'default_method_name': 'EqualFreq',
            '__version__': 2,
            "context_settings": [Context(values=context_values)]
        }

        OWDiscretize.migrate_settings(settings, 2)
        self.assertNotIn("default_method_name", settings)
        self.assertNotIn("default_k", settings)
        self.assertNotIn("default_cutpoints", settings)
        self.assertNotIn("context_settings", settings)
        self.assertEqual(
            settings["var_hints"], {
                None: VarHint(Methods.EqualFreq, (3, )),
                ('ST by exercise', False): VarHint(Methods.MDL, ()),
                ('age', False): VarHint(Methods.Keep, ()),
                ('cholesterol', False): VarHint(Methods.EqualFreq, (6, )),
                ('max HR', True): VarHint(Methods.Custom, (('1, 2, 3'), )),
                ('rest SBP', False): VarHint(Methods.EqualWidth, (4, ))
            })
コード例 #2
0
    from Orange.widgets.data.owdiscretize import OWDiscretize
    from Orange.widgets.model.owrandomforest import OWRandomForest

    iris = Table("iris")
    app = QApplication(sys.argv)

    main = OWReport.get_instance()
    file = OWFile()
    file.create_report_html()
    main.make_report(file)

    table = OWDataTable()
    table.set_dataset(iris)
    table.create_report_html()
    main.make_report(table)

    main = OWReport.get_instance()
    disc = OWDiscretize()
    disc.create_report_html()
    main.make_report(disc)

    learner = OWRandomForest()
    learner.create_report_html()
    main.make_report(learner)

    main.show()
    main.saveSettings()
    assert main.table_model.rowCount() == 4

    sys.exit(app.exec_())
コード例 #3
0
ファイル: owreport.py プロジェクト: benzei/orange3
    from Orange.widgets.data.owdiscretize import OWDiscretize
    from Orange.widgets.model.owrandomforest import OWRandomForest

    iris = Table("iris")
    app = QApplication(sys.argv)

    main = OWReport.get_instance()
    file = OWFile()
    file.create_report_html()
    main.make_report(file)

    table = OWDataTable()
    table.set_dataset(iris)
    table.create_report_html()
    main.make_report(table)

    main = OWReport.get_instance()
    disc = OWDiscretize()
    disc.create_report_html()
    main.make_report(disc)

    learner = OWRandomForest()
    learner.create_report_html()
    main.make_report(learner)

    main.show()
    main.saveSettings()
    assert main.table_model.rowCount() == 4

    sys.exit(app.exec_())