kiudee / cs-ranking

Context-sensitive ranking and choice in Python with PyTorch
https://cs-ranking.readthedocs.io
Apache License 2.0
66 stars 15 forks source link

PairwiseSVM fails on set_params #173

Closed kiudee closed 4 years ago

kiudee commented 4 years ago

PairwiseSVM allows the user to specify the regularization strength C as hyperparameter: https://github.com/kiudee/cs-ranking/blob/f5b74e3bc1eec4a65720bd2a633ad632e6d003a6/csrank/choicefunction/pairwise_choice.py#L15

Trying to set the parameter using set_params fails as follows:

File "virtualenvs/pareto-c0hfaRc1-py3.7/lib/python3.7/site-packages/sklearn/base.py", line 261, in set_params
    valid_params[key].set_params(**sub_params)
File "virtualenvs/pareto-c0hfaRc1-py3.7/lib/python3.7/site-packages/csrank/learner.py", line 74, in set_params
    self._store_kwargs(params, allowed_prefixes)
File "virtualenvs/pareto-c0hfaRc1-py3.7/lib/python3.7/site-packages/csrank/learner.py", line 38, in _store_kwargs
    f"'__init__() got an unexpected keyword argument '{key}'. Allowed prefixes: {allowed_prefixes}."
TypeError: '__init__() got an unexpected keyword argument 'C'. Allowed prefixes: [].