Skip to content

train() got an unexpected keyword argument 'reweighter' #903

@heury

Description

@heury

🐛 Bug Description

To Reproduce

Steps to reproduce the behavior:

  1. python workflow.py get_data
  2. python workflow.py dump_and_load_dataset
  3. qrun .\examples\highfreq\workflow_config_High_Freq_Tree_Alpha158.yaml

Expected Behavior

I got an following error when running hifreq example.

TypeError: train() got an unexpected keyword argument 'reweighter'

I can fix it by adding reweighter parameter to highfreq_gdbt_model.py

def fit(
self,
dataset: DatasetH,
num_boost_round=1000,
early_stopping_rounds=50,
verbose_eval=20,
evals_result=dict(),
reweighter=None,
**kwargs
):

Is it a right solution to fix this error?

Screenshot

File "C:\dev\Anaconda3\envs\py38_torch\lib\site-packages\pyqlib-0.8.3.99-py3.8-win-amd64.egg\qlib\workflow\cli.py", line 57, in workflow
recorder = task_train(config.get("task"), experiment_name=experiment_name)
File "C:\dev\Anaconda3\envs\py38_torch\lib\site-packages\pyqlib-0.8.3.99-py3.8-win-amd64.egg\qlib\model\trainer.py", line 118, in task_train
_exe_task(task_config)
File "C:\dev\Anaconda3\envs\py38_torch\lib\site-packages\pyqlib-0.8.3.99-py3.8-win-amd64.egg\qlib\model\trainer.py", line 40, in exe_task
auto_filter_kwargs(model.fit)(dataset, reweighter=reweighter)
File "C:\dev\Anaconda3\envs\py38_torch\lib\site-packages\pyqlib-0.8.3.99-py3.8-win-amd64.egg\qlib\utils_init
.py", line 852, in _func
return func(*args, **new_kwargs)
File "C:\dev\Anaconda3\envs\py38_torch\lib\site-packages\pyqlib-0.8.3.99-py3.8-win-amd64.egg\qlib\contrib\model\highfreq_gdbt_model.py", line 117, in fit
self.model = lgb.train(
TypeError: train() got an unexpected keyword argument 'reweighter'
PS C:\dev\qlib> python .\setup.py install

Environment

Note: User could run cd scripts && python collect_info.py all under project directory to get system information
and paste them here directly.

  • Qlib version: pyqlib-0.8.3.99-py3.8-win-amd64.egg\
  • Python version: 3.8
  • OS (Windows, Linux, MacOS): Windows
  • Commit number (optional, please provide it if you are using the dev version):

Additional Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions