小编dok*_*who的帖子

LightGBM:Sklearn 和 Native API 等效项

我正在通过 Training API http://lightgbm.readthedocs.io/en/latest/Python-API.html#training-api和 Scikit-learn API http://lightgbm.readthedocs.io/en/latest/试验 LightGBM Python-API.html#scikit-learn-api

我无法在两个 API 之间做出清晰的映射,如下例中突出显示的那样。基本思想是在 50% 的合成数据集上进行训练。

import numpy as np
import lightgbm as lgbm

# Generate Data Set
xs = np.linspace(0, 10, 100).reshape((-1, 1)) 
ys = xs**2 + 4*xs + 5.2
ys = ys.reshape((-1,))

# LGBM configuration
alg_conf = {
    "num_boost_round":25,
    "max_depth" : 3,
    "num_leaves" : 31,
    'learning_rate' : 0.1,
    'boosting_type' : 'gbdt',
    'objective' : 'regression_l2',
    "early_stopping_rounds": None,
}

# Calling Regressor using scikit-learn API 
sk_reg = lgbm.sklearn.LGBMRegressor(
    num_leaves=alg_conf["num_leaves"], 
    n_estimators=alg_conf["num_boost_round"], …
Run Code Online (Sandbox Code Playgroud)

machine-learning scikit-learn lightgbm

7
推荐指数
1
解决办法
5339
查看次数

标签 统计

lightgbm ×1

machine-learning ×1

scikit-learn ×1