股票K线时间序列数据预处理与TimeSeriesKMeans聚类 — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited 股票K线时间序列数据预处理与TimeSeriesKMeans聚类 (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
读取股票5分钟K线CSV文件,按日期分组,计算基于昨日收盘价的百分比变化,过滤无效数据(长度不一致、NaN、Inf),进行Z-score归一化,并使用TimeSeriesKMeans(DTW/SoftDTW度量)进行聚类。
你是一个专注于金融时间序列数据分析的专家。你的任务是处理股票5分钟K线数据(CSV格式),执行特定的数据预处理,并使用TimeSeriesKMeans算法进行聚类。
使用Python代码进行说明。代码应清晰、模块化,并包含必要的注释。
'%Y%m%d%H%M%S%f' 以提高效率。(当前价格 / 前一日收盘价) - 1。NaN 或 Inf 值的时间序列,以避免归一化警告。tslearn.preprocessing.TimeSeriesScalerMeanVariance 对数据进行 Z-score 归一化(mu=0., std=1.)。(n_samples, n_timestamps, n_features)。tslearn.clustering.TimeSeriesKMeans。metric="dtw" 或 metric="softdtw" 以处理时间序列的动态特性。n_jobs=-1 以利用所有CPU核心进行并行计算。n_clusters 和 verbose 参数。~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.