How to speed up sklearn SVR?

淺唱寂寞╮ 提交于 2021-02-07 03:21:35

问题


I am implementing SVR using sklearn svr package in python. My sparse matrix is of size 146860 x 10202. I have divided it into various sub-matrices of size 2500 x 10202. For each sub matrix, SVR fitting is taking about 10 mins. What could be the ways to speed up the process? Please suggest any different approach or different python package for the same. Thanks!


回答1:


You can average the SVR sub-models predictions.

Alternatively you can try to fit a linear regression model on the output of kernel expansion computed with the Nystroem method.

Or you can try other non-linear regression models such as ensemble of randomized trees or gradient boosted regression trees.

Edit: I forgot to say: the kernel SVR model itself is not scalable as its complexity is more than quadratic hence there is no way to "speed it up".

Edit 2: Actually, often scaling the input variables to [0, 1] or [-1, 1] or to unit variance using StandardScaler can speed up the convergence by quite a bit.

Also it is very unlikely that the default parameters will yield good results: you have to grid search the optimal value for gamma and maybe also epsilon on a sub samples of increasing sizes (to check the stability of the optimal parameters) before fitting to large models.



来源:https://stackoverflow.com/questions/15582669/how-to-speed-up-sklearn-svr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!