首页 > 其他分享 >【799】lightGBM实现

【799】lightGBM实现

时间:2023-01-14 15:45:35浏览次数:62  
标签:selection lightGBM 实现 gbm 799 train test import sklearn

参考:LightGBM使用

参考:在Python中使用Lightgbm

参考:官网 - lightgbm.LGBMClassifier

from sklearn.model_selection import train_test_split

X_train, X_test, y_train, y_test = train_test_split(stat_data, mode_data, test_size=0.2) 

import lightgbm as lgb 
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import GridSearchCV
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.datasets import  make_classification

gbm = lgb.LGBMRegressor(objective='regression',num_leaves=1024,learning_rate=0.05,n_estimators=512,max_depth=15)
gbm.fit(X_train, y_train,eval_set=[(X_test, y_test)],eval_metric='l1',early_stopping_rounds=5)

y_pred = gbm.predict(X_test, num_iteration=gbm.best_iteration_)

 

标签:selection,lightGBM,实现,gbm,799,train,test,import,sklearn
From: https://www.cnblogs.com/alex-bn-lee/p/17051924.html

相关文章