Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpu support and sklearn support #91

Open
BinchaoPeng opened this issue Aug 19, 2021 · 12 comments
Open

gpu support and sklearn support #91

BinchaoPeng opened this issue Aug 19, 2021 · 12 comments

Comments

@BinchaoPeng
Copy link

请问现在可以支持gpu了吗?另外是否支持sklearn的gridSearchCV呢?

@IncubatorShokuhou
Copy link
Contributor

IncubatorShokuhou commented Aug 19, 2021

@BinchaoPeng 可以自定义estimators和predictor,然后使用支持gpu的评估器作为estimator和predictor。详见https://deep-forest.readthedocs.io/en/stable/advanced_topics/use_customized_estimator.html

@IncubatorShokuhou
Copy link
Contributor

IncubatorShokuhou commented Aug 19, 2021

另外,如果你不自定义estimator和predictor的话,cv应该是没问题的。但是如果你用了customized estimators的话,那就会出bug了,因为cv里面会用到sklearn.base.clone (见https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/model_selection/_search.py#L769)

关于clone引起bug的问题,可以看我新提交的issure: #92

@xuyxu
Copy link
Member

xuyxu commented Aug 19, 2021

感谢 @IncubatorShokuhou 的说明。关于使用GPU,可以考虑使用cuml中的随机森林:https://docs.rapids.ai/api/cuml/stable/api.html#random-forest

@BinchaoPeng
Copy link
Author

好的,谢谢,我去看看

@xuyxu
Copy link
Member

xuyxu commented Aug 19, 2021

如果准备尝试的话,十分欢迎您在这个issue下面进行反馈 ;-)

@BinchaoPeng
Copy link
Author

恩恩,好的,希望这个project可以实现gpu支持和sklearn支持

@BinchaoPeng
Copy link
Author

还是报错了,关于GridSearchCV的:

/home/pbc/anaconda3/envs/cuda9/lib/python3.6/site-packages/sklearn/model_selection/_validation.py:700: UserWarning: Scoring failed. The score on this train-test partition for these parameters will be set to nan. Details: 
Traceback (most recent call last):
[CV 1/5] END predictor=xgboost; accuracy: (test=nan) average_precision: (test=nan) f1: (test=nan) roc_auc: (test=nan) total time=10.0min
  File "/home/pbc/anaconda3/envs/cuda9/lib/python3.6/site-packages/sklearn/metrics/_scorer.py", line 56, in _cached_call
    return cache[method]
KeyError: 'decision_function'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/pbc/anaconda3/envs/cuda9/lib/python3.6/site-packages/sklearn/metrics/_scorer.py", line 334, in _score
    y_pred = method_caller(clf, "decision_function", X)
  File "/home/pbc/anaconda3/envs/cuda9/lib/python3.6/site-packages/sklearn/metrics/_scorer.py", line 58, in _cached_call
    result = getattr(estimator, method)(*args, **kwargs)
AttributeError: 'CascadeForestClassifier' object has no attribute 'decision_function'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/pbc/anaconda3/envs/cuda9/lib/python3.6/site-packages/sklearn/model_selection/_validation.py", line 687, in _score
    scores = scorer(estimator, X_test, y_test)
  File "/home/pbc/anaconda3/envs/cuda9/lib/python3.6/site-packages/sklearn/metrics/_scorer.py", line 88, in __call__
    *args, **kwargs)
  File "/home/pbc/anaconda3/envs/cuda9/lib/python3.6/site-packages/sklearn/metrics/_scorer.py", line 353, in _score
    y_pred = self._select_proba_binary(y_pred, clf.classes_)
AttributeError: 'CascadeForestClassifier' object has no attribute 'classes_'
  UserWarning,

@xuyxu
Copy link
Member

xuyxu commented Aug 19, 2021

好的,我周末研究一下。

@BinchaoPeng
Copy link
Author

BinchaoPeng commented Aug 20, 2021

class_
decision_funtion
这两个链接或许有用

@BinchaoPeng
Copy link
Author

好的,我周末研究一下。

请问你搞定了吗?发现不结合网格搜索和交叉验证这两个功能,不好实用,建议还是接入sklearn比较好

@py666888
Copy link

请问不自定义分类器,现在支持网格搜索调参吗?

@BinchaoPeng
Copy link
Author

请问不自定义分类器,现在支持网格搜索调参吗?

需要自己实现,不支持sklearn,按照sklearn的方式实现就可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants