Yu-Group / iterative-Random-Forest

Python implementation of iterative-random-forests
Other
59 stars 19 forks source link

Test error: __init__() got an unexpected keyword argument 'presort' #13

Open eskrav opened 3 years ago

eskrav commented 3 years ago

Running package tests results in the following error (python version 3.6.12, sklearn 0.24.1, numpy 1.17.5, scipy 1.4.1, cython 0.29.22, pydotplus 2.0.2, matplotlib 3.0.3, jupyter 1.0.0, pyyaml 5.4.1):

ekravtchenko@server:~/iterative-Random-Forest$ python irf/tests/test_irf_utils.py
Traceback (most recent call last):
  File "irf/tests/test_irf_utils.py", line 14, in <module>
    sklearn_ds=breast_cancer, n_estimators=10)
  File "/home/ekravtchenko/iterative-Random-Forest/irf/irf_jupyter_utils.py", line 110, in generate_rf_example
    rf.fit(X=X_train, y=y_train)
  File "/home/ekravtchenko/iterative-Random-Forest/irf/ensemble/wrf.py", line 20, in fit
    self.base_estimator = WeightedDecisionTreeClassifier()
  File "/home/ekravtchenko/iterative-Random-Forest/irf/tree/tree.py", line 401, in __init__
    ccp_alpha=ccp_alpha)
  File "/home/ekravtchenko/.conda/envs/new_frgpy/lib/python3.6/site-packages/sklearn/utils/validation.py", line 63, in inner_f
    return f(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'presort'

ekravtchenko@server:~/iterative-Random-Forest$ python irf/tests/test_irf_weighted.py
Traceback (most recent call last):
  File "irf/tests/test_irf_weighted.py", line 70, in <module>
    test_iRF_weight1()
  File "irf/tests/test_irf_weighted.py", line 34, in test_iRF_weight1
    n_estimators_bootstrap=5)
  File "/home/ekravtchenko/iterative-Random-Forest/irf/irf_utils.py", line 589, in run_iRF
    X_test = X_test, y_test = y_test)
  File "/home/ekravtchenko/iterative-Random-Forest/irf/ensemble/wrf.py", line 65, in fit
    feature_weight=feature_importances)
  File "/home/ekravtchenko/iterative-Random-Forest/irf/ensemble/wrf.py", line 20, in fit
    self.base_estimator = WeightedDecisionTreeClassifier()
  File "/home/ekravtchenko/iterative-Random-Forest/irf/tree/tree.py", line 401, in __init__
    ccp_alpha=ccp_alpha)
  File "/home/ekravtchenko/.conda/envs/new_frgpy/lib/python3.6/site-packages/sklearn/utils/validation.py", line 63, in inner_f
    return f(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'presort'
akialbz commented 3 years ago

I believe that's because the presort parameter has been deprecated and removed from the 0.24 scikit-learn

eskrav commented 3 years ago

Thanks! It does indeed work if I install a previous version of scikit-learn.