class lightgbm.LGBMClassifier(boosting_type='gbdt', num_leaves=31, max_depth=-1, learning_rate=0.1, n_estimators=10, max_bin=255, subsample_for_bin=200000, objective=None, min_split_gain=0.0, min_child_weight=0.001, min_child_samples=20, subsample=1.0, subsample_freq=1, colsample_bytree=1.0, reg_alpha=0.0, reg_lambda=0.0, random_state=None, n_jobs=-1, silent=True, **kwargs)

boosting_type
default="gbdt"

"gbdt":Gradient Boosting Decision Tree

"dart":Dropouts meet Multiple Additive Regression Trees

"goss":Gradient-based One-Side Sampling

"rf": Random Forest

 
num_leaves  (intoptional (default=31)) 每个基学习器的最大叶子节点 <=2^max_depth
max_depth  (intoptional (default=-1)) 每个基学习器的最大深度, -1 means no limit 当模型过拟合,首先降低max_depth 
learning_rate (floatoptional (default=0.1))  Boosting learning rate  
n_estimators (intoptional (default=10))   基学习器的数量  
max_bin  (intoptional (default=255)) feature将存入的bin的最大数量,应该是直方图的k值  
subsample_for_bin  (intoptional (default=50000)) Number of samples for constructing bins  
objective  (stringcallable or Noneoptional (default=None))

default:

‘regression’ for LGBMRegressor,

‘binary’ or ‘multiclass’ for LGBMClassifier,

‘lambdarank’ for LGBMRanker.

 
min_split_gain  (floatoptional (default=0.)) 树的叶子节点上进行进一步划分所需的最小损失减少  
min_child_weight   (floatoptional (default=1e-3))
Minimum sum of instance weight(hessian) needed in a child(leaf)

 
min_child_samples 
(intoptional (default=20) 叶子节点具有的最小记录数  
subsample 
(floatoptional (default=1.) 训练时采样一定比例的数据  
subsample_freq  (intoptional (default=1)) Frequence of subsample, <=0 means no enable  
colsample_bytree 
(floatoptional (default=1.) Subsample ratio of columns when constructing each tree  
reg_alpha
(floatoptional (default=0.))  L1 regularization term on weights  

reg_lambda

(floatoptional (default=0.)) L2 regularization term on weights  

random_state

(int or Noneoptional (default=None)    
silent (booloptional (default=True))    
n_jobs  (intoptional (default=-1))    

          




######################################################################################################

下表对应了Faster Spread,better accuracy,over-fitting三种目的时,可以调整的参数:

########################################################################################### 

类的属性:

n_features_ int  特征的数量
classes_ rray of shape = [n_classes]  类标签数组(只针对分类问题)
n_classes_ int  类别数量   (只针对分类问题)
best_score_ dict or None  最佳拟合模型得分
best_iteration_ int or None  如果已经指定了early_stopping_rounds,则拟合模型的最佳迭代次数
objective_ string or callable  拟合模型时的具体目标
booster_ Booster 这个模型的Booster
evals_result_ dict or None  如果已经指定了early_stopping_rounds,则评估结果
feature_importances_ array of shape = [n_features] 特征的重要性

###########################################################################################

类的方法: 

fit(X, y, sample_weight=None, init_score=None, eval_set=None, eval_names=None, eval_sample_weight=None, eval_init_score=None, eval_metric='logloss', early_stopping_rounds=None, verbose=True, feature_name='auto', categorical_feature='auto', callbacks=None)
X array-like or sparse matrix of shape = [n_samplesn_features] 特征矩阵
y array-like of shape = [n_samples] The target values (class labels in classification, real numbers in regression)
sample_weight  array-like of shape = [n_samples] or Noneoptional (default=None)) 样本权重,可以采用np.where设置
init_score array-like of shape = [n_samples] or Noneoptional (default=None)) Init score of training data
group array-like of shape = [n_samples] or Noneoptional (default=None) Group data of training data.
eval_set  list or Noneoptional (default=None)  A list of (X, y) tuple pairs to use as a validation sets for early-stopping
eval_names  list of strings or Noneoptional (default=None) Names of eval_set
eval_sample_weight  list of arrays or Noneoptional (default=None) Weights of eval data
eval_init_score  list of arrays or Noneoptional (default=None)  Init score of eval data
eval_group list of arrays or Noneoptional (default=None)  Group data of eval data
eval_metric stringlist of stringscallable or Noneoptional (default="logloss")  "mae","mse",...
early_stopping_rounds int or Noneoptional (default=None)  一定rounds,即停止迭代
verbose  booloptional (default=True)  
feature_name  list of strings or 'auto'optional (default="auto") If ‘auto’ and data is pandas DataFrame, data columns names are used
categorical_feature  list of strings or int, or 'auto'optional (default="auto") If ‘auto’ and data is pandas DataFrame, pandas categorical columns are used
callbacks list of callback functions or Noneoptional (default=None)  




###############################################################################################
 predict_proba(X, raw_score=False, num_iteration=0)
X  array-like or sparse matrix of shape = [n_samplesn_features] Input features matrix
raw_score booloptional (default=False) Whether to predict raw scores
num_iteration intoptional (default=0)  Limit number of iterations in the prediction; defaults to 0 (use all trees).
Returns predicted_probability  The predicted probability for each class for each sample.
Return type array-like of shape = [n_samples, n_classes]  

不平衡处理的参数:

1.一个简单的方法是设置is_unbalance参数为True或者设置scale_pos_weight,二者只能选一个。 设置is_unbalance参数为True时会把负样本的权重设为:正样本数/负样本数。这个参数只能用于二分类。

2.自定义评价函数:

https://cloud.tencent.com/developer/article/1357671

lightGBM的原理总结:

http://www.cnblogs.com/gczr/p/9024730.html

论文翻译:https://blog.csdn.net/u010242233/article/details/79769950https://zhuanlan.zhihu.com/p/42939089

处理分类变量的原理:https://blog.csdn.net/anshuai_aw1/article/details/83275299

CatBoost、LightGBM、XGBoost的对比

https://blog.csdn.net/LrS62520kV/article/details/79620615

 



lightgbm的sklearn接口和原生接口参数详细说明及调参指点的更多相关文章

  1. xgboost的sklearn接口和原生接口参数详细说明及调参指点

    from xgboost import XGBClassifier XGBClassifier(max_depth=3,learning_rate=0.1,n_estimators=100,silen ...

  2. word2vec参数调整 及lda调参

     一.word2vec调参   ./word2vec -train resultbig.txt -output vectors.bin -cbow 0 -size 200 -window 5 -neg ...

  3. DeepMind提出新型超参数最优化方法:性能超越手动调参和贝叶斯优化

    DeepMind提出新型超参数最优化方法:性能超越手动调参和贝叶斯优化 2017年11月29日 06:40:37 机器之心V 阅读数 2183   版权声明:本文为博主原创文章,遵循CC 4.0 BY ...

  4. python+pytest接口自动化(6)-请求参数格式的确定

    我们在做接口测试之前,先需要根据接口文档或抓包接口数据,搞清楚被测接口的详细内容,其中就包含请求参数的编码格式,从而使用对应的参数格式发送请求.例如某个接口规定的请求主体的编码方式为 applicat ...

  5. android 学习随笔二十七(JNI:Java Native Interface,JAVA原生接口 )

    JNI(Java Native Interface,JAVA原生接口) 使用JNI可以使Java代码和其他语言写的代码(如C/C++代码)进行交互. 问:为什么要进行交互? 首先,Java语言提供的类 ...

  6. 接口作为方法的参数或返回值——List接口

    接口作为方法的参数或返回值,源码可知,List为一个接口,ArraryList是的它的实现类: 其中,addNames方法中,入参和返回值都List接口,入参是多态的,编译看左,运行看右(访问成员方法 ...

  7. 编写高质量代码改善C#程序的157个建议——建议43:让接口中的泛型参数支持协变

    建议43:让接口中的泛型参数支持协变 除了上一建议中提到的使用泛型参数兼容接口不可变性外,还有一种办法是为接口中的泛型声明加上out关键字来支持协变,如下所示: interface ISalary&l ...

  8. Python+request 分模块存放接口,多接口共用参数URL、headers的抽离,添加日志打印等《三》

    主要介绍内容如下: 1.分模块存放接口 2.多接口共用参数URL.headers的抽离为配置文件 3.添加日志打印 4.一个py文件运行所有所测的接口 如上介绍内容的作用: 1.分模块存放接口:方便多 ...

  9. 对接接口时,组织参数json出现的问题

    在进行对接第三方接口时,进行参数组装成json的过程中出现参数传递格式错误以及json格式化错误. 在拼接json时,如果json中有对象,则以map的方式组装好所有参数.最后map转成json,不然 ...

随机推荐

  1. Nginx——debug的使用

    个人理解,debug的用处在于可以更进一步地了解页面访问出现问题的原因 nginx的debug的功能需要在编译安装时使用–with-debug选项 ./configure --prefix=/usr/ ...

  2. kustomize 模版自由的配置&&自定义kubernetes工具

    kustomize 是一个可以方便我们基于模版配置,自定义kubernetes 的工具,类似kompose,但是个人觉得kompose 更灵活点,而且使用上更方便 安装 mac brew instal ...

  3. codeblock设置快捷键

    第一步: 第二步: 第三步:  格式化代码设置: 在代码框里点右键,按Format use Astyle就会自动代码格式化了 但是它默认的风格是大括号另起一行,很不习惯,实际上是可以改的 1.Sett ...

  4. e的故事.一个常数的传奇 (Eli Maor 著)

    第1章 约翰*纳皮尔 (已看) 第2章 认知 (已看) 对数运算 第3章 财务问题 (已看) 第4章 若极限存在,则达之 (已看) 一些与e有关的奇妙的数 第5章 发现微积分的先驱 (已看) 第6章 ...

  5. Monte Carlo tree search 学习

    https://en.wikipedia.org/wiki/Monte_Carlo_tree_search 蒙特卡洛树搜索(MCTS)基础 http://mcts.ai/about/index.htm ...

  6. day7大纲

    01 昨日内容回顾 数据类型补充: str <---> list split join list <---> set set(list) list(set()) list &l ...

  7. Docker中使用nginx镜像

    1.到网易蜂巢查看nginx https://c.163yun.com/hub#/m/home/ 复制nginx镜像地址为:docker pull hub.c.163.com/library/ngin ...

  8. Flume 高可用配置案例+load balance负载均衡+ 案例:日志的采集及汇总

    高可用配置案例 (一).failover故障转移 在完成单点的Flume NG搭建后,下面我们搭建一个高可用的Flume NG集群,架构图如下所示: (1)节点分配 Flume的Agent和Colle ...

  9. piwik高负载加速之切换session存储位置

    默认情况下,piwik的session是存储于根目录下面的tmp/sessions/路径下面的.而官方文档里面说,如果由于本地硬盘的原因,这种设置可能会导致系统被变慢,这在高负载系统应用中可能是不可以 ...

  10. MS Batch AI

    微软的Batch AI服务是一项新服务,它可以帮助你在GPU pool上训练和测试机器学习模型,包括深度学习模型.它简化了在当前许多流行的深度学习框架(如TensorFlow.Microsoft认知工 ...