Orange Forum • View topic - Equal Width Discretization + .setText()

Equal Width Discretization + .setText()

A place to ask questions about methods in Orange and how they are used and other general support.

Equal Width Discretization + .setText()

Postby Will282 » Thu Jul 31, 2014 12:18

Hi,

I am trying to implement a binning algorithm in orange and would like to call the Orange.feature.discretization.EqualWidth() and set the width that it uses to discretise the data instead of setting the number of bins.

Is this possible? Or does anyone have an suggestions as to how to go about doing this?

Many thanks,
Will
Last edited by Will282 on Wed Aug 13, 2014 19:26, edited 1 time in total.

Re: Equal Width Discretization

Postby Ales » Tue Aug 05, 2014 9:48

Will282 wrote:I am trying to implement a binning algorithm in orange and would like to call the Orange.feature.discretization.EqualWidth() and set the width that it uses to discretise the data instead of setting the number of bins.
Orange.feature.discretization.EqualWidth can't be used in this way. You might want to use Orange.feature.discretization.EqualWidthDiscretizer (Orange.feature.discretization.EqualWidth is actually just a wrapper of this).
Example
Code: Select all
iris = Orange.data.Table("iris")
ewd = Orange.feature.discretization.EqualWidthDiscretizer(first_cut=0.0, step=1.0, n=10)
dvar = ewd.construct_variable(iris.domain["sepal length"])

Re: Equal Width Discretization

Postby Will282 » Wed Aug 13, 2014 17:48

That's perfect. Thanks very much for your help Ales.

I am also having a problem with using the .setText() method on a OWGUI.widgetlabel() object to update the text it displays. It will simply not update the text.

Code: Select all
self.h_val_info = OWGUI.widgetLabel(box5, "h: ")


Code: Select all
def set_h_text(self, h_val):
    self.h_val_info.setText("h: "+str(h_val))


I know that set_h_text method is being called but it is not changing the text on the widget.

Cheers,
Will

Re: Equal Width Discretization + .setText()

Postby Will282 » Wed Aug 13, 2014 22:11

I have figured out what I was doing completely wrong and managed to fix the issue. Apologies.

Will


Return to Questions & Support