Orange Forum • View topic - Attribute type

Attribute type

Discussions about new ideas and features you would like to see in Orange.
(Archived/read-only, please use our ticketing system for your wishes and their discussion.)
Forum rules
(Archived/read-only, please use our ticketing system for your wishes and their discussion.)

Attribute type

Postby orennahum » Tue Feb 21, 2006 12:54

Hi,

Can you add an Orange Widget that will allow to change the type of an attribute. When I open a file with Orange, it automaticlly detects it's attributes and their type, I want to be able to manually change the type.

Thanks,
Oren.

Postby sesam » Tue Feb 21, 2006 13:59

The easiest solution is probably to edit your data into a format orange understands. Start looking here:
http://www.ailab.si/orange/doc/ofb/load_data.htm

There are widgets Discretize and Continuize, but they convert all of your attributes.

(I tried cirumventing this using "Select Attributes" to make one attribute a meta attributes, with the plan to move it back to a normal attribute after discretization. But my attempt failed since Discretize seems to discard metadata.)

Thanks

Postby Guest » Tue Feb 21, 2006 15:01

I know that I can edit the file myself. The thing is that if I have a very very large file it may be very defecualt. I'm thinking about having some thing like Clemintine has.

Postby Janez » Wed Feb 22, 2006 20:47

I don't know exactly what you mean by changing the attribute type (and I don't know any Clementine :-). You want to change a (coded) discrete attribute into continuous?

Say you have loaded servo, where the third attribute is discrete and can have values "3", "4", "5" and "6". And say you want to change it into a continuous attribute with the same values.

Code: Select all
a2 = orange.FloatVariable("X")
a2.getValueFrom = lambda ex,foo: float(str(ex[2]))
nd = orange.Domain(servo.domain[:2] + [a2] + servo.domain[3:])
dd = orange.ExampleTable(nd, servo)


We first create a new attribute. The second line tells that a2 is computed by taking the third attribute (of example ex), converting it into a string and then to float. Then we create a new domain and rewrite the existing table. (If the table is large, this gives you two large tables in the memory at once.)

Is this what you need?


Return to Wish List



cron