[scikit-learn] Using GPU in scikit learn

Brown J.B. jbbrown at kuhp.kyoto-u.ac.jp
Wed Aug 8 21:33:18 EDT 2018

Dear Ta Hoang,

GPU processing can be done with Python libraries such as TensorFlow, Keras,
or Theano.

However, sklearn's implementation of RandomForestClassifier is
outstandingly fast, and a previous effort to develop GPU RandomForest
abandoned their efforts as a result:

If you need to speed up predictions because of a large dataset, you can
combine joblib with sklearn to utilize parallelize the predictions of the
individual trees:
from joblib import Parallel, delayed
predictions = Parallel(n_jobs=n,
backend=backend)(delayed(your_forest_prediction_func)(func_arguments) for
tree_group in tree_groups))
where, n is how many parallel computations you want to execute, and backend
is either "threading" or "multiprocessing".
Typically, your_forest_predict_func() would iterate over the collection of
trees and prediction objects given in func_arguments using a single

Hope this helps you parallelize and speed-up.

J.B. Brown
Kyoto University Graduate School of Medicine

2018-08-09 9:50 GMT+09:00 hoang trung Ta <tahoangtrung at gmail.com>:

> Dear all members,
> I am using Random forest for classification satellite images. I have a
> bunch of images, thus the processing is quite slow. I searched on the
> Internet and they said that GPU can accelerate the process.
> I have GPU NDVIA Geforce GTX 1080 Ti installed in the computer
> Do you know how to use GPU in Scikit learn, I mean the packages to use and
> sample code that used GPU in random forest classification?
> Thank you very much
> --
> *Ta Hoang Trung (Mr)*
> *Master student*
> Graduate School of Life and Environmental Sciences
> University of Tsukuba, Japan
> Mobile:  +81 70 3846 2993
> Email :  ta.hoang-trung.xm at alumni.tsukuba.ac.jp
>              tahoangtrung at gmail.com
>              s1626066 at u.tsukuba.ac.jp
> *----*
> *Mapping Technician*
> Department of Surveying and Mapping Vietnam
> No 2, Dang Thuy Tram street, Hanoi, Viet Nam
> Mobile: +84 1255151344
> Email : tahoangtrung at gmail.com
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20180809/b9d0b9ce/attachment-0001.html>

More information about the scikit-learn mailing list