I am using Orange (in Python) for some data mining tasks. More specifically, for clustering. Although I have gone through the tutorial and read most of the documentation, I still have a problem. All the examples in docs and tutorials assume that I have a tab delimited table with data in it. However, there is nothing saying how one can go about creating a new table from scratch. For example, I want to create a table for word frequencies across different documents.
Maybe I am missing something so if anyone has any insight it'd be appreciated.
Thanks George
This is how I create my table
#First construct the domain object (top row)
vars = []
for var in variables:
vars.append(Orange.data.variable.Continuous(str(var)))
domain = Orange.data.Domain(vars, classed) #The second argument indicated that the last attr must not be a class
#Add data rows assuming we have a matrix
t = Orange.data.Table(domain, matrix)
This took me hours to figure out. In python, do this:
Import Orange
List, Of, Column, Variables = [Orange.feature.Discrete(x) for x in ['What','Theyre','Called','AsStrings']]
Domain = Orange.data.Domain([List, Of, Column, Variables])
Table = Orange.data.Table(Domain)
Table.save('NewTable.tab')
I'd tell you what each bit of code does, but as of now I'm not really sure. It's funny that such a powerful toolkit should have such hard to understand documentation, but I suspect it's because it's entire user base has doctorates.
The documentation is indeed insufficient if you ask me. This may not be the answer to the question but it could be helpful to someone else. I tried for hours to create a Table using constructors and Domains and what not, just for an association rule mining task, and finally found out that the easiest way to create a table is simply to write your data to a file with the extension .tab or .basket and create a table from that.
Orange.data.Table("yourFile.basket")
Of course the structure of the file needs to be correct. See the provided example files located in the Orange package directory inside datasets/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With