light gbm - python API vs Scikit-learn API

隐身守侯 提交于 2019-12-19 04:02:16

问题


I was trying to apply lgbm in one of my problems. For that I was going through "http://lightgbm.readthedocs.io/en/latest/Python-API.html". However, I have a basic question. Is there any difference between Training API and Scikit-learn API? Can we use both the APIs to achieve same result for the same problem?

Thanks, Dipanjan.


回答1:


The short answer: yes, they will provide identical results if you will configure them in identical ways.

The reason is that sklearn API is just a wrapper around the "native training" API, which in turn is a wrapper around the backend C++ library. At the end, this is your choice to make. I personally would advice in favour of the sklearn API. The 2 major advantages are:

  • you can make use of full sklearn toolkit (pipelines with data preprocessing, hyperparameter optimisation, model evalueation, etc)
  • you can switch between different model in a painless way, i.e. your input data has the same format (pd.DataFrame or np.ndarray), trainign interface is the same and you can switch between sklearn models, lightgbm, xgboost, catboost or vowpal wabbit by simply instantiating different objects and passing them through the same procedure.


来源:https://stackoverflow.com/questions/51077816/light-gbm-python-api-vs-scikit-learn-api

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