Java:如何使用Weka生成的模型组装/创建单个实例进行分类? [英] Java: How can I assemble/create a single instance for classification using a Weka generated model?

查看:205
本文介绍了Java:如何使用Weka生成的模型组装/创建单个实例进行分类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找这个问题的答案一段时间无济于事。

I've been searching for an answer to this for a while to no avail.

首先介绍一下:我正在尝试使用Weka为robocode创建一个AI。
我首先将手动机器人所需的数据记录到ARFF文件中,这是正常的。

First a bit of background: I'm trying to create an AI for robocode using Weka. I'm first logging the required data from a manual robot to an ARFF file, this is working as it should.

然后使用Weka和创建的模型对此数据进行处理,然后保存此文件。

This data is then processed this using Weka and a model created, I'm then saving this file.

我可以成功导入模型并对从另一个arff文件导入的数据集进行分类并使用结果。

I can successfully import the model and classify a dataset that has been imported from another arff file and use the results.

我现在想要做的就是每次游戏状态更改是组合一个实例并对其进行分类,以便使用我之前保存的模型来决定移动的方式等。

What I want to do now is every time the game status changes is assemble an instance and classify it, to decide for example which way to move etc. using my previously saved model.

我试图查看它维基: http://weka.wikispaces.com/Programmatic+Use
和这个ibm教程: http://www.ibm.com/developerworks/opensource/ library / os-weka3 / 为一对夫妇命名,我也一直在查看API,但这并没有给我太多的帮助。

I've tried to look it up on the wiki: http://weka.wikispaces.com/Programmatic+Use and this ibm tutorial: http://www.ibm.com/developerworks/opensource/library/os-weka3/ to name a couple, I've also been looking through the APIs but that hasn't given me much to go on.

我尝试过的大部分内容都被弃用了,例如创建了一个版本type与属性和快速矢量然后创建一个空数据集。然后使用诸如inst.setvalue(attrib,value)之类的东西创建一个具有所需值的新实例,并将其添加到数据集中。

Much of what I've tried is deprecated, for example creating a prototype with the attributes and fast vectors then creating an empty dataset. Then creating a new instance with the required values using somthing like inst.setvalue(attrib, value) and adding it to the dataset.

那么类索引,或者我正在预测的属性,在实例中它必须为空或设置为缺失或某些东西,因为我试图预测它时,我不会知道该值吗?

Also what about the class index, or the attribute I'm predicting, in the instance does it have to be null or set to missing or something, as surley I won't know that value as I'm trying to predict it?

那么我有什么想法可以解决这个问题吗?

So are there any ideas how I can go about this?

非常感谢任何帮助,

非常感谢。

推荐答案

管理层找到答案。

对于其他任何遇到此问题的人来说,基本上你要做的就是每次下载时都附带的Weka手册(它是一个pdf)。

For anyone else having trouble with this basically what you have to do is in the Weka manual included with every download, (its a pdf).

手册中的第202页 - 第16.3节在内存中创建数据集。
按照那里的步骤完成它。

Page 202 onwards in the manual - Section 16.3 "Creating datasets in memory". Follow the steps there and it works perfectly.

这篇关于Java:如何使用Weka生成的模型组装/创建单个实例进行分类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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