VeighNa量化社区
你的开源社区量化交易平台
Member
avatar
加入于:
帖子: 2
声望: 0

这是原代码:
setting = OptimizationSetting()
setting.set_target("return_drawdown_ratio")
setting.add_parameter("fixed_window",6,20,2)

ga_out = engine.run_ga_optimization(setting)
ga_out

运行一会后就报错:
Traceback (most recent call last):
File "c:\vnstudio\lib\multiprocessing\pool.py", line 121, in worker
result = (True, func(args, **kwds))
File "c:\vnstudio\lib\multiprocessing\pool.py", line 44, in mapstar
return list(map(
args))
File "c:\vnstudio\lib\site-packages\vnpy\trader\optimize.py", line 229, in ga_evaluate
cache[tp] = result
File "<string>", line 2, in setitem
File "c:\vnstudio\lib\multiprocessing\managers.py", line 811, in _callmethod
raise convert_to_error(kind, result)

multiprocessing.managers.RemoteError:

Traceback (most recent call last):
File "c:\vnstudio\lib\multiprocessing\managers.py", line 234, in serve_client
request = recv()
File "c:\vnstudio\lib\multiprocessing\connection.py", line 251, in recv
return _ForkingPickler.loads(buf.getbuffer())
AttributeError: Can't get attribute 'dtype' on <module 'numpy' from 'c:\vnstudio\lib\site-packages\numpy\init.py'>

有时候改变回测的日期期间就能解决,相当于一个个试错过去
求助,到底是哪里的问题

Member
avatar
加入于:
帖子: 1638
声望: 119

这个报错是numpy上获取不到dtype吧

Member
avatar
加入于:
帖子: 1638
声望: 119

看了下你这里用的应该是老版本,升级到3.4.0最新版试试吧

Member
avatar
加入于:
帖子: 126
声望: 4

可能是numpy版本问题

Member
avatar
加入于:
帖子: 2
声望: 0

MTF wrote:

看了下你这里用的应该是老版本,升级到3.4.0最新版试试吧
原本numpy是1.18.2,我把numpy更新到1.21.6或者1,21,5,出现的问题是ValueError: empty range for randrange() (1,1, 0)

Member
avatar
加入于:
帖子: 5018
声望: 303

遗传优化不能只选一组参数

© 2015-2022 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号

沪公网安备 31011502017034号

【用户协议】
【隐私政策】
【免责条款】