gpt4 book ai didi

python - pybrain NNregression工具参数

转载 作者:行者123 更新时间:2023-11-30 09:54:53 25 4
gpt4 key购买 nike

我正在尝试使用 pybrain 中的NNregression 工具:http://pybrain.org/docs/api/tools.html

我有我的数据集:

ds = SupervisedDataSet(20,1)
for x, y in zip(inputs, outputs):
ds.appendLinked(x,y)

我可以通过以下初始化来训练网络......

n = NNregression(ds)

...但它突然停止并出现以下错误:

epoch   1000  total error       8.5458   avg weight          6.28
epoch 1001 total error 8.5313 avg weight 6.2823
epoch 1002 total error 8.5149 avg weight 6.2851
epoch 1003 total error 8.5003 avg weight 6.2882
epoch 1004 total error 8.4801 avg weight 6.2922
Traceback (most recent call last):
File "regression.py", line 108, in <module>
trainer = BackpropTrainer(n, ds, verbose = True)
File "/mounts/u-zon-d2/ugrad/kmwe236/pybrain/pybrain/supervised/trainers/backprop.py", line 37, in __init__
self.setData(dataset)
File "/mounts/u-zon-d2/ugrad/kmwe236/pybrain/pybrain/supervised/trainers/trainer.py", line 22, in setData
assert dataset.indim == self.module.indim

因此,我尝试更改参数以包括验证器和测试集,如文档要求的那样:

val_data = SupervisedDataSet(20,1)
for x, y in zip(validator_inputs, validator_outputs):
val_data.appendLinked(x,y)

test_data = SupervisedDataSet(20,1)
for x, y in zip(prediction_inputs, prediction_outputs):
test_data.appendLinked(x,y)


n = NNregression(dataset=ds, hidden=3, TDS=test_data, VDS=val_data, epoinc=750)

但是当我尝试执行时,它提示参数的数量:

violet:~/pybrain> python regression.py
Traceback (most recent call last):
File "regression.py", line 95, in <module>
n = NNregression(dataset=ds, hidden=3, tds=test_data, vds=val_data, epoinc=750)
TypeError: __init__() takes exactly 2 arguments (1 given)

最佳答案

至少对我来说,它无法识别关键字“数据集”。它获取 1 个参数(self),但它需要 self 和一个数据集。尝试将行更改为:

n = NNregression(ds,hidden=3,tds=test_data,vds=val_data,epoinc=750)

关于python - pybrain NNregression工具参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35664249/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com