LightBGM之Dataset

最近使用了LightBGM的Dataset,记录一下:

1.说明:  classlightgbm.Dataset(datalabel=Nonereference=Noneweight=Nonegroup=Noneinit_score=Nonesilent=Falsefeature_name='auto'categorical_feature='auto'params=Nonefree_raw_data=True)

Bases: object

Dataset in LightGBM.

Constract Dataset.

Parameters:
  • data (stringnumpy arraypandas DataFramescipy.sparse or list of numpy arrays) – Data source of Dataset. If string, it represents the path to txt file.
  • label (listnumpy 1-D arraypandas one-column DataFrame/Series or Noneoptional (default=None)) – Label of the data.
  • reference (Dataset or Noneoptional (default=None)) – If this is Dataset for validation, training data should be used as reference.
  • weight (listnumpy 1-D arraypandas Series or Noneoptional (default=None)) – Weight for each instance.
  • group (listnumpy 1-D arraypandas Series or Noneoptional (default=None)) – Group/query size for Dataset.
  • init_score (listnumpy 1-D arraypandas Series or Noneoptional (default=None)) – Init score for Dataset.
  • silent (booloptional (default=False)) – Whether to print messages during construction.
  • feature_name (list of strings or 'auto'optional (default="auto")) – Feature names. If ‘auto’ and data is pandas DataFrame, data columns names are used.
  • categorical_feature (list of strings or int, or 'auto'optional (default="auto")) – Categorical features. If list of int, interpreted as indices. If list of strings, interpreted as feature names (need to specify feature_name as well). If ‘auto’ and data is pandas DataFrame, pandas categorical columns are used. All values in categorical features should be less than int32 max value (2147483647). All negative values in categorical features will be treated as missing values.
  • params (dict or Noneoptional (default=None)) – Other parameters.
  • free_raw_data (booloptional (default=True)) – If True, raw data is freed after constructing inner Dataset.

  输出是一个dataset对象

2.使用:

  根据说明使用自己的数据,我这里data和label都用了DataFrame格式的

 

转载于:https://www.cnblogs.com/demo-deng/p/9613259.html

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值