Pybrain交叉验证方法 [英] Pybrain cross-validation method

查看:95
本文介绍了Pybrain交叉验证方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对数据使用交叉验证器,但是成功率却是0.0,这没有任何意义.

I'm trying to use the cross-validator on my data, but I'm getting 0.0 success rate, which doesn't make sense.

我的数据由具有5个连续属性和两个可能类别的样本组成:"y"和"n".

My data is comprised of samples with 5 continuous attributes and two possible classes: "y" and "n".

我的代码:

net = pybrain.tools.shortcuts.buildNetwork(5, 8, 1)
trainer = BackpropTrainer(net, ds)
evaluation = ModuleValidator.classificationPerformance(trainer.module, ds)
validator = CrossValidator(trainer=trainer, dataset=trainer.ds, n_folds=5, valfunc=evaluation)
print(validator.validate())

当我像这样进行常规训练时

When I'm doing a regular training like so

print(trainer.train())

我得到了一个合理的错误率,所以我猜这意味着数据集和网络都可以,而且问题出在交叉验证器中.

I'm getting a reasonable error rate, so I'm guessing this means the dataset and network are okay, and the problem is in the cross validator.

有什么想法吗?

更新:

我查看了交叉验证码,发现我的网络输出连续值,而不是所需的0/1.我猜这些是每个班级的概率.当在交叉验证方法中使用该模型时,它并不能说明问题,这意味着所有答案都被认为是不稳定的,因为我得到了0个正确答案.如何添加一个查看连续值并根据较大的值返回0或1的图层?文档不清楚.

I looked in the cross-validation code and noticed that my network outputs continuous values and not 0/1 as required. I'm guessing these are the probabilities for each class. When the model is used inside the cross-validation methods it does not account for that, and this means all answers are regarded as flase, si I'm getting 0 correct answers. How can I add a layer that looks at the continuous values and returns 0 or 1 according to whichever is bigger? The documentation is unclear.

推荐答案

我也在研究神经网络,我建议您检查

I am working on neural networks too, i recommend your to check the FANN library with python bindings, its better and easier to use than pybrain

这篇关于Pybrain交叉验证方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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