KLine Slicer 是 KLine-Kronos-Suite 中的第三个核心组件,专门负责将 5 分钟的 K 线 CSV 文件转换为深度学习模型(如 Kronos)可以直接消化的张量数据。它不仅是一个切片工具,更是一个数据“质检员”。
Designed for integration with time-series forecasting foundation models like Kronos (@shiyu-coder/Kronos).
- [ 数据健康体检 (Health Check) ]:自动检测原始 5m CSV 中的空值(NaN)、零成交量、以及异常时间缺口,确保进入模型的数据 100% 纯净。
- [ 专家对齐切片 (Expert Slicing) ]:自动加载
X-Matrix项目中的scaler_*.pkl归一化密钥,确保数据预处理逻辑与模型训练时完全一致(90日回望 + 10日预测)。 - [ 板块全家桶并行 (Group Slicing) ]:支持一次性勾选整个板块的股票,将它们合并并打散成一个统一的
.npy训练集,极大提升模型对于板块共性的学习能力。
- 源路径挂载:将挂载点指向程序 2 生成的
gui_out_5m文件夹。 - 专家选择:根据你要投喂的“大脑”选择对应的专家编号(如
expert_02_ai)。 - 点火生产:点击“开始切片生产”,生成的
.npy数据包将存放于gui_out_slices目录下,可直接复制到服务器进行训练。
- 注入流 (Input):
- 数据实体:
2-KLine-Resample提取的5m.csv时序合集。 - 模型预设:
X-Matrix模型框架依赖的独家scaler_*.pkl均值方差归一化密钥文件。
- 数据实体:
- 输出张量 (Output): 完全符合高维模型特征张量接口规则的
.npyNumpy 三维数组。- 数组命名规范:
slices_[expert_id]_[生成时间戳].npy - 张量维度 (Shape):
(样本条目数 N, 回望窗口 Lookback + 预测视野 Predict, 特征通道数 Features)
- 数组命名规范:
- 工程设计哲学 (Why Tensor Slice?): 摒弃传统项目一边在 DataLoader 训练、一边动态切片的 CPU 密集型灾难开销。通过 Slicer 直接将数千份物理
.csv并发组装成紧凑的内存块连续 Numpy 矩阵,使得核心 Transformer 网络训练流能够达到最大吞吐满载。
KLine Slicer is the third core component of the KLine-Matrix-Suite. It is specialized in converting 5-minute K-Line CSV files into tensor data payloads that Deep Learning models (like Kronos) can directly consume.
- [ Data Health Check ]: Automatically detects NaNs, zero-volume bars, and timestamp gaps in the raw 5m CSVs, ensuring 100% data integrity for training.
- [ Expert-Aligned Slicing ]: Automatically loads the corresponding
scaler_*.pklfrom theX-Matrixproject, ensuring that the normalization logic stays 100% consistent with the model's training specs (90-day lookback + 10-day prediction). - [ Group/Batch Production ]: Select multiple stocks from the same sector to merge them into a single
.npytraining dataset, enhancing the model's ability to learn sector-wide temporal patterns.
Author: Ziqi | License: MIT | Design Language: Cyber-Gold
