jma127 / pyltr

Python learning to rank (LTR) toolkit
BSD 3-Clause "New" or "Revised" License
464 stars 107 forks source link

Remove a deprecated parameter #25

Closed wararaki718 closed 3 years ago

wararaki718 commented 3 years ago

This pull request is to remove the deprecated parameter.

presort was deprecated in v0.24. https://scikit-learn.org/0.23/modules/generated/sklearn.tree.DecisionTreeRegressor.html#sklearn.tree.DecisionTreeRegressor

So, if we use the latest scikit-learn, this library is not running.

Traceback (most recent call last):
  File "sample_pyltr/main.py", line 52, in <module>
    main()
  File "sample_pyltr/main.py", line 39, in main
    model.fit(X_train, y_train, qid_train, monitor=monitor)
  File "/home/wararaki/.cache/pypoetry/virtualenvs/sample-pyltr-KjsgfJ4m-py3.8/lib/python3.8/site-packages/pyltr/models/lambdamart.py", line 200, in fit
    n_stages = self._fit_stages(X, y, qids, y_pred,
  File "/home/wararaki/.cache/pypoetry/virtualenvs/sample-pyltr-KjsgfJ4m-py3.8/lib/python3.8/site-packages/pyltr/models/lambdamart.py", line 406, in _fit_stages
    y_pred = self._fit_stage(i, X, y, qids, y_pred, sample_weight,
  File "/home/wararaki/.cache/pypoetry/virtualenvs/sample-pyltr-KjsgfJ4m-py3.8/lib/python3.8/site-packages/pyltr/models/lambdamart.py", line 338, in _fit_stage
    tree = sklearn.tree.DecisionTreeRegressor(
TypeError: __init__() got an unexpected keyword argument 'presort'

The parameter is not exist in the current stable version. https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeRegressor.html

jma127 commented 3 years ago

Awesome, many thanks for fixing this issue!