当前位置:网站首页>Qlib quantitative source analysis: qlib/qlib/contrib/model/GBDT py
Qlib quantitative source analysis: qlib/qlib/contrib/model/GBDT py
2022-08-01 00:02:00 【Artificial Intelligence Zeng Xiaojian】
qlib gbd (lightgbm) uses an interface very similar to sklearn, and dataset.prepare returns the training set and test set.
Look at the code of the GBDT module, it first calls _prepare_data, using the data set dataset.prepare function, get two parts of train and valid, and then perform basic data inspection and transformation to fit the model.
def _prepare_data(self, dataset: DatasetH, reweighter=None) -> List[Tuple[lgb.Dataset, str]]:"""The motivation of current version is to make validation optional- train segment is necessary;"""ds_l = []assert "train" in dataset.segmentsfor key in ["train", "valid"]:if key in dataset.segments:df = dataset.prepare(key, col_set=["feature", "label"], data_key=DataHandlerLP.DK_L)if df.empty:raise ValueError("Empty data from dataset, please check your dataset config.")x, y = df["feature"], df["label"]# Lightgbm need 1D array as its labelif y.values.ndim == 2 and y.values.shape[1] == 1:y = np.squeeze(y.values)else:raise ValueError("LightGBM doesn't support multi-label training")if reweighter is None:w = Noneelif isinstance(reweighter, Reweighter):w = reweighter.reweight(df)else:raise ValueError("Unsupported reweighter type.")ds_l.append((lgb.Dataset(x.values, label=y, weight=w), key))return ds_l边栏推荐
- 22年8月推广大使额外奖励规则
- LeetCode--打家劫舍问题
- Shell common scripts: Nexus batch upload local warehouse enhanced version script (strongly recommended)
- SQL注入 Less47(报错注入) 和Less49(时间盲注)
- [QNX Hypervisor 2.2用户手册]9.15 suppress
- 基于simulink的Passive anti-islanding-UVP/OVP and UFP/OFP被动反孤岛模型仿真
- 10大主流3D建模技术
- 基于mysql的消息队列设计
- 对象缓存服务的思考和实现
- Shell常用脚本:Nexus批量上传本地仓库增强版脚本(强烈推荐)
猜你喜欢

How to reduce the gap between software design and implementation

C# Rectangle基本用法和图片切割

zeno使用方法笔记

UOS - WindTerm use

Matlab / ArcGIS 处理GPM全球月均降水数据
I don't know what to do with sync issues

Advanced Algebra _ Proof _ Any matrix is similar to an upper triangular matrix

cobaltstrike

Program processes and threads (concurrency and parallelism of threads) and basic creation and use of threads

Kyoto University:Masaki Waga | 黑箱环境中强化学习的动态屏蔽
随机推荐
Kyoto University:Masaki Waga | 黑箱环境中强化学习的动态屏蔽
一文概述:VPN的基本模型及业务类型
博弈论(Depu)与孙子兵法(42/100)
Redis五种数据类型简介
[1161. The maximum sum of elements in the layer]
Flutter教程之 01配置环境并运行demo程序 (教程含源码)
SQL注入 Less47(报错注入) 和Less49(时间盲注)
Basic use of vim - bottom line mode
leetcode:126. 单词接龙 II
对象缓存服务的思考和实现
IPD流程专业术语
Weekly Summary
Shell common scripts: Nexus batch upload local warehouse enhanced version script (strongly recommended)
One line of code to solve CoreData managed object properties change in SwiftUI problem of animation effects
SQL injection Less54 (limited number of SQL injection + union injection)
Program processes and threads (concurrency and parallelism of threads) and basic creation and use of threads
新产品如何进行网络推广?
To help the construction of digital government, the three parties of China Science and Technology build a domain name security system
继承和友元,静态成员的关系
高等代数_证明_任何矩阵都相似于一个上三角矩阵