如何在Orange中创建新的数据表? [英] How do I create a new data table in Orange?

查看:471
本文介绍了如何在Orange中创建新的数据表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Orange(在Python中)执行某些数据挖掘任务.更具体地说,是用于群集.尽管我已经阅读了本教程并阅读了大多数文档,但是仍然有问题. 文档和教程中的所有示例均假设我有一个制表符分隔的表,其中包含数据.但是,没有什么可以说的从头开始创建一个新表.例如,我想为不同文档中的词频创建一个表.

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.

谢谢 乔治

这就是我创建表格的方式

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)        

推荐答案

这花了我几个小时才弄清楚.在python中,执行以下操作:

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.

这篇关于如何在Orange中创建新的数据表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆