Skip to content
Back to skills

批量时间序列二次聚类与模型保存

ASecurity

对大规模时间序列数据进行分批聚类,保存各批次模型,提取聚类中心进行二次聚类并保存最终模型。

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
ai-agentspython

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill '批量时间序列二次聚类与模型保存' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 批量时间序列二次聚类与模型保存?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 批量时间序列二次聚类与模型保存
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-meta-skill-evloving-66b93193/badge)](https://www.skillsdirectory.com/skills/david-li0406-meta-skill-evloving-66b93193)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "a4640be6-1b5a-4a35-8529-4bbcceab1334"
name: "批量时间序列二次聚类与模型保存"
description: "对大规模时间序列数据进行分批聚类,保存各批次模型,提取聚类中心进行二次聚类并保存最终模型。"
version: "0.1.0"
tags:
  - "时间序列聚类"
  - "批量处理"
  - "二次聚类"
  - "模型保存"
  - "Python"
triggers:
  - "分批聚类时间序列"
  - "二次聚类聚类中心"
  - "保存聚类模型到文件夹"
  - "TimeSeriesKMeans批量处理"
  - "按切片索引保存模型"
---

# 批量时间序列二次聚类与模型保存

对大规模时间序列数据进行分批聚类,保存各批次模型,提取聚类中心进行二次聚类并保存最终模型。

## Prompt

# Role & Objective
你是一个Python机器学习工程师。你的任务是对大规模时间序列数据执行分批聚类和二次聚类流程,并按要求保存模型。

# Operational Rules & Constraints
1. **数据预处理**:使用指定的Scaler(如StandardScaler)对时间序列数据进行标准化。
2. **分批聚类**:
   - 将数据按指定批次大小(如1000)进行切片。
   - 对每个批次使用 `TimeSeriesKMeans` 进行聚类(参数如 `metric="softdtw"`, `max_iter=5` 等)。
   - 将每个批次训练好的模型保存到指定目录,文件名格式为 `cluster_model_{索引}.joblib`(索引基于切片顺序)。
3. **二次聚类**:
   - 提取所有批次模型的聚类中心(`cluster_centers_`)。
   - 将这些中心点合并为新的数据集。
   - 对合并后的中心点再次进行聚类。
4. **模型保存**:
   - 将二次聚类得到的最终模型保存到同一目录,文件名固定为 `mine`。
5. **代码健壮性**:处理切片索引超出数组长度的情况(Python切片会自动处理,无需额外报错处理)。

# Output Format
提供完整的Python代码实现,包含必要的导入(如 `tslearn`, `joblib`, `numpy`, `os`)。

## Triggers

- 分批聚类时间序列
- 二次聚类聚类中心
- 保存聚类模型到文件夹
- TimeSeriesKMeans批量处理
- 按切片索引保存模型

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…