如何在Weka中使用JSON文件 [英] How do I use a JSON file with weka
问题描述
我有一个JSON文件,并想打开weka中的数据,但是当我这样做时,出现以下错误: 无法加载JSON文件
I have a JSON file and want to open the data in weka, but when I do, I get the following error:
在邮件列表中,有几个问题关于JSON,但有关TL; DR的信息,只是我注意到在"weka期望的格式"中谈到了JSON.当然,没有提到该格式是什么.即将在源头进行一次潜水,但是我希望SO用户可以在我花太多时间之前提供帮助.
Looking around on the mailing list, there are a few questions about JSON, but TL;DR except that I noticed talk of JSON in the "format weka expects". Of course, there was no mention of what that format is. About to take a dive in the source, but I hope SO users can help before I spend too much time on this.
推荐答案
以了解JSON对象的格式及其与ARFF的关系.步骤非常简单. 使用GUI工具执行以下操作:
To gain an understanding about the format of the JSON object and its relationship to ARFF. The steps were surprisingly simple. Use the GUI tool to do the following:
- 选择资源管理器选项
- 在预处理"选项卡上选择打开的文件
- 加载任何默认提供的ARFF文件
- 选择保存,然后可以选择JSON扩展名
基本上每个JSON文件都必须具有: {header:{关系:,属性:[{},{}],数据:[{},{}]}}}}
basically every JSON file must have: {header:{ relation: , attributes:[{},{}],data:[{},{}]}}}
希望这会有所帮助
{"houses":{
"relation":"house",
"attributes":{
"houseSize":["NUMERIC"],
"lotSize":
"bedrooms":
"granite":
"bathroom":
"sellingPrice":
},
"data":[
[3529,9191,6,0,0,205000 ],
[3247,10061,5,1,1,224900],
[4032,10150,5,0,1,197900 ],
[2397,14156,4,1,0,189900 ],
[2200,9600,4,0,1,195000],
[3536,19994,6,1,1,325000 ],
[2983,9365,5,0,1,230000]
]}}
可以为属性指定更多信息,如下所示:
The attributes can have more information specified to them as follows:
{"contact_lenses":{
"relation": "contact-lenses",
"attributes" : {
"age":["young", "pre-presbyopic", "presbyopic"],
"spectacle-prescrip":["myope", "hypermetrope"],
"astigmatism":["no", "yes"],
"tear-prod-rate":["reduced", "normal"],
"contact-lenses":["soft", "hard", "none"]
},
"data":[]
}
}
这篇关于如何在Weka中使用JSON文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!