def main():  # pragma: no cover
    """Helper for running the widget without Orange."""
    logging.basicConfig(level=logging.DEBUG)
    signal.signal(signal.SIGINT, signal.SIG_DFL)
    app = QtWidgets.QApplication(sys.argv)
    indicators_widget = OWWorldBankIndicators()
    indicators_widget.show()
    app.exec_()
    indicators_widget.saveSettings()
def create_coef_table(classifier):
    i = classifier.intercept
    c = classifier.coefficients
    if c.shape[0] > 2:
        values = [
            classifier.domain.class_var.values[int(i)]
            for i in classifier.used_vals[0]
        ]
    else:
        values = [
            classifier.domain.class_var.values[int(classifier.used_vals[0][1])]
        ]
    domain = Domain(
        [ContinuousVariable(value, number_of_decimals=7) for value in values],
        metas=[StringVariable("name")])
    coefs = np.vstack((i.reshape(1, len(i)), c.T))
    names = [[attr.name] for attr in classifier.domain.attributes]
    names = [["intercept"]] + names
    names = np.array(names, dtype=object)
    coef_table = Table.from_numpy(domain, X=coefs, metas=names)
    coef_table.name = "coefficients"
    return coef_table


if __name__ == "__main__":
    app = QtWidgets.QApplication([])
    w = OWLogisticRegression()
    w.set_data(Table("zoo"))
    w.show()
    app.exec_()
Ejemplo n.º 3
0
        self.class_treatment = class_treatment

    def __call__(self, data):
        treat = self.multinomial_treatment
        if isinstance(data, Orange.data.Domain):
            domain, data = data, None
        else:
            domain = data.domain

        if (treat == Continuize.ReportError
                and any(var.is_discrete and len(var.values) > 2
                        for var in domain)):
            raise ValueError("Domain has multinomial attributes")

        newdomain = continuize_domain(data or domain,
                                      self.multinomial_treatment,
                                      self.continuous_treatment,
                                      self.class_treatment, self.zero_based)
        return newdomain


if __name__ == "__main__":
    import sys
    a = QtWidgets.QApplication(sys.argv)
    ow = OWContinuize()
    data = Table("lenses")
    ow.setData(data)
    ow.show()
    a.exec_()
    ow.saveSettings()