You can drop duplicate edges by setting the 'duplicates' kwarg


(figoliu) #1
策略测试时正常,开始交易后报错,日志如下

'[2019-02-20 00:36:04] bigquant: instruments.v2 开始运行..'
'[2019-02-20 00:36:05] bigquant: 命中缓存'
'[2019-02-20 00:36:05] bigquant: instruments.v2 运行完成[0.04724s].'
'[2019-02-20 00:36:05] bigquant: advanced_auto_labeler.v2 开始运行..'
'[2019-02-20 00:36:05] 自动标注(股票): 加载历史数据: 3571 行'
'[2019-02-20 00:36:05] 自动标注(股票): 开始标注 ..'
'[2019-02-20 00:36:05] bigquant: module name: advanced_auto_labeler, module version: v2, trackeback: Traceback (most recent call last):\n  File "module2/common/moduleinvoker.py", line 198, in biglearning.module2.common.moduleinvoker._invoke_with_cache\n  File "module2/common/moduleinvoker.py", line 154, in biglearning.module2.common.moduleinvoker._module_run\n  File "/var/app/enabled/biglearning/module2/modules/advanced_auto_labeler/v2/__init__.py", line 125, in run\n    df[\'label\'] = bigexpr.evaluate(df, expr, self.__user_functions)\n  File "impl/expression.py", line 308, in bigexpr.impl.expression.evaluate\n  File "impl/expression.py", line 146, in bigexpr.impl.expression.__evaluate_ast\n  File "impl/functions.py", line 29, in bigexpr.impl.functions.UserFunctions.all_wbins\n  File "/usr/local/python3/lib/python3.5/site-packages/pandas/core/reshape/tile.py", line 136, in cut\n    dtype=dtype)\n  File "/usr/local/python3/lib/python3.5/site-packages/pandas/core/reshape/tile.py", line 234, in _bins_to_cuts\n    "the \'duplicates\' kwarg".format(bins=bins))\nValueError: Bin edges must be unique: array([-inf,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,\n        nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  inf]).\nYou can drop duplicate edges by setting the \'duplicates\' kwarg\n'
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-ca92b887257d> in <module>()
    122     benchmark='000300.SHA',
    123     drop_na_label=True,
--> 124     cast_label_int=True
    125 )
    126 

/var/app/enabled/biglearning/module2/common/modulemanagerv2.cpython-35m-x86_64-linux-gnu.so in biglearning.module2.common.modulemanagerv2.BigQuantModuleVersion.__call__()

/var/app/enabled/biglearning/module2/common/moduleinvoker.cpython-35m-x86_64-linux-gnu.so in biglearning.module2.common.moduleinvoker.module_invoke()

/var/app/enabled/biglearning/module2/common/moduleinvoker.cpython-35m-x86_64-linux-gnu.so in biglearning.module2.common.moduleinvoker._invoke_with_cache()

/var/app/enabled/biglearning/module2/common/moduleinvoker.cpython-35m-x86_64-linux-gnu.so in biglearning.module2.common.moduleinvoker._invoke_with_cache()

/var/app/enabled/biglearning/module2/common/moduleinvoker.cpython-35m-x86_64-linux-gnu.so in biglearning.module2.common.moduleinvoker._module_run()

/var/app/enabled/biglearning/module2/modules/advanced_auto_labeler/v2/__init__.py in run(self)
    123 
    124         for expr in self.__label_expr:
--> 125             df['label'] = bigexpr.evaluate(df, expr, self.__user_functions)
    126 
    127         if self.__drop_na_label:

/var/app/enabled/bigexpr/impl/expression.cpython-35m-x86_64-linux-gnu.so in bigexpr.impl.expression.evaluate()

/var/app/enabled/bigexpr/impl/expression.cpython-35m-x86_64-linux-gnu.so in bigexpr.impl.expression.__evaluate_ast()

/var/app/enabled/bigexpr/impl/functions.cpython-35m-x86_64-linux-gnu.so in bigexpr.impl.functions.UserFunctions.all_wbins()

/usr/local/python3/lib/python3.5/site-packages/pandas/core/reshape/tile.py in cut(x, bins, right, labels, retbins, precision, include_lowest)
    134                               precision=precision,
    135                               include_lowest=include_lowest,
--> 136                               dtype=dtype)
    137 
    138     return _postprocess_for_cut(fac, bins, retbins, x_is_series,

/usr/local/python3/lib/python3.5/site-packages/pandas/core/reshape/tile.py in _bins_to_cuts(x, bins, right, labels, precision, include_lowest, dtype, duplicates)
    232             raise ValueError("Bin edges must be unique: {bins!r}.\nYou "
    233                              "can drop duplicate edges by setting "
--> 234                              "the 'duplicates' kwarg".format(bins=bins))
    235         else:
    236             bins = unique_bins

ValueError: Bin edges must be unique: array([-inf,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,
        nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  inf]).
You can drop duplicate edges by setting the 'duplicates' kwarg

(figoliu) #2

@iQuant 搜了一下论坛,好像以前解决过类似问题,但好像又出现了。


(iQuant) #3

您好,收到您的提问,我们帮您看一下。


(达达) #4

检查一下在送入训练之前是否有缺失值处理模块


(figoliu) #5

谢谢,训练和预测前都加了缺失值处理模块的。