当前位置:网站首页>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边栏推荐
- 日常--Kali开启SSH(详细教程)
- 开源好用的 流程图绘制工具 drawio
- 10大主流3D建模技术
- 力扣二叉树
- 输入输出优化
- Interview Question: Implementing Deadlocks
- 自动化机器学习pycaret: PyCaret Basic Auto Classification LightGBM
- 力扣2326、197
- 继承和友元,静态成员的关系
- The difference between adding or not adding the ref keyword when a variable of reference type is used as a parameter in a method call in C#
猜你喜欢

一文概述:VPN的基本模型及业务类型

嵌入式开发没有激情了,正常吗?

推荐系统:常用评价指标总结【准确率、精确率、召回率、命中率、(归一化折损累计增益)NDCG、平均倒数排名(MRR)、ROC曲线、AUC(ROC曲线下的面积)、P-R曲线、A/B测试】

Shell常用脚本:Nexus批量上传本地仓库增强版脚本(强烈推荐)

/etc/sysconfig/network-scripts configure the network card

消息队列存储消息数据的MySQL表格

Shell common script: Nexus batch upload local warehouse script

基于mysql的消息队列设计

浏览器下载快捷方式到桌面(PWA)

编译型语言和解释型语言的区别
随机推荐
如何设计高可用高性能中间件 - 作业
日常--Kali开启SSH(详细教程)
嵌入式开发没有激情了,正常吗?
Handwritten a simple web server (B/S architecture)
date命令
Daily--Kali opens SSH (detailed tutorial)
Network security - crack WiFi through handshake packets (detailed tutorial)
如何导入 Golang 外部包并使用它?
Usage of mysql having
Difference Between Stateless and Stateful
2022年最新重庆建筑八大员(电气施工员)模拟题库及答案
I don't know what to do with sync issues
ICML2022 | 深入研究置换敏感的图神经网络
@JsonFormat(pattern=“yyyy-MM-dd“)时间差问题
二叉树遍历非递归程序 -- 使用栈模拟系统栈
Drawing process of hand-drawn map of scenic spots
[AMEX] LGBM Optuna美国运通信用卡欺诈赛 kaggle
2022-07-31:给出一个有n个点,m条有向边的图, 你可以施展魔法,把有向边,变成无向边, 比如A到B的有向边,权重为7。施展魔法之后,A和B通过该边到达彼此的代价都是7。 求,允许施展一次魔法
Weekly Summary
Flutter教程之 02 Flutter 桌面程序开发入门教程运行hello world (教程含源码)