Logo Time Series Sports

Time Series Sports

Cộng đồng
WalrusQuant
time-series-sports

Xây dựng và so sánh các đặc trưng phong độ thể thao bảo đảm không rò rỉ thông tin thời gian. Dùng cho cửa sổ trượt, EWMA, thời gian nghỉ, khoảng cách giữa các trận, xử lý đầu mùa giải và đánh giá theo thứ tự thời gian.

Add to TypingMind

Tổng quan

Nhà phát hànhWalrusQuant
Kho mãsports-analytic-skills
Tên kỹ năngtime-series-sports
Sao
53
Bản fork
4
Tệp đi kèm
5
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 5 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được WalrusQuant công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Time Series Sports trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/WalrusQuant/sports-analytic-skills/tree/main/skills/time-series-sports
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/WalrusQuant/sports-analytic-skills.git /tmp/sports-analytic-skills
mkdir -p .claude/skills
cp -r /tmp/sports-analytic-skills/skills/time-series-sports .claude/skills/time-series-sports
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Time Series Sports trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Time Series Sports ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Time Series Sports với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Time Series & Form (Sports)

Overview

Sports performance is ordered in time. This skill builds form features and simple trajectory forecasts that are legal at decision time T:

  • rolling means
  • expanding rates
  • EWMA / decay
  • rest gaps
  • regime flags

The bundled helper constructs shifted EWMA features from a user-owned event table, and the comparison helper evaluates already-computed feature sets.

Non-negotiable: shift (or as-of) so the current game is never inside the feature.


When to Use This Skill

Use when:

  • Team/player form features for pre-game models
  • Rolling averages, EWMA, half-life decay
  • Forecasting next-game stats from trajectories
  • Handling bye weeks, missing games, season breaks
  • Comparing recency-weighted form vs static season averages
  • User says “hot streak,” “last 5,” or “recent form”

Do not use when:

NeedGo instead
Pure cross-sectional comparison with no recencyEDA / stats skills
Opponent-adjusted strength is the real goalalso ratings-strength-models
Static season aggregates already sufficient and time-safesimpler baselines
Feature legality review of a finished matrixleakage-audit

Installation

ewma_form.py requires pandas. compare_form_windows.py additionally requires NumPy and scikit-learn:

bash
python -m pip install pandas numpy scikit-learn

Parquet input also needs pyarrow or fastparquet.


Workflow

  1. Define the entity and frequency (team-game, player-game, week).
  2. Sort by entity + time; handle missing games explicitly.
  3. Choose window/decay rules; tune only inside training folds.
  4. Apply shift(1) / as-of so current game is never inside the feature.
  5. Compare form features against static baselines under walk-forward validation.
  6. Watch early-season small-sample explosions — min-games thresholds or shrinkage.
  7. Document window/span, shift rule, and min history.
  8. Hand off to baselines / predictive models / leakage audit.

Core Techniques

TechniqueSports useTime-safety rule
Expanding meanseason-to-date win % / PFshift before expand
Rolling meanlast K games formshift then rolling
EWMArecency-weighted formewm on shifted series
Rest daysschedule gapsdiff of game dates
Season phaseweek number, monthknown pre-game
Regime splitrule changes, coaching erasflag by date known at T

Read form_feature_recipes.md when implementing rolling, expanding, or EWMA features. Read early_season.md when choosing priors, minimum history, or shrinkage. Read rest_and_gaps.md for byes, calendar gaps, and elapsed-time features.


Standalone Feature Construction

ewma_form.py requires non-null entity/reset keys, parseable finite numeric or timestamp time/order fields, and numeric or boolean value dtypes (including pandas nullable numeric/boolean dtypes). It rejects infinite values and contradictory event ordering. Missing observations in value columns remain missing—they are never filled with zero—before each value is shifted by one event and summarized with pandas EWMA semantics.

bash
python /path/to/time-series-sports/scripts/ewma_form.py \
  --input team_games.csv --entity-col team --time-col event_time \
  --order-col event_sequence --group-cols season \
  --values won,point_margin --span 5 \
  --out team_games_with_ewma.csv

Generated fields are named pre_ewma_<value>. Omitting --group-cols carries history across the full entity timeline. If --time-col can tie, --order-col must encode genuine event order; an arbitrary row ID is not enough.

Opponent features

Compute each participant's history independently, then join the participant and opponent snapshots by stable event/entity keys. Assert that both snapshots were available before the event. Never derive opponent form from the focal row's current result.

Compare feature sets

bash
python /path/to/time-series-sports/scripts/compare_form_windows.py \
  --input modeling_table.csv --target won --split-col season \
  --features-a pre_roll3_win,pre_roll3_margin \
  --features-b pre_ewma_won,pre_ewma_point_margin

The comparison uses identical expanding folds and complete cases shared by both feature sets. It validates binary targets and finite numeric features, but does not impute them. It evaluates hypotheses already encoded in the supplied columns; it does not make illegal features legal.

Early-Season Handling

ProblemMitigation
Week 1 empty historyNA features + drop or league prior
Tiny n rolling windowsrequire pre_games_played >= k
Noisy short rollsshrinkage toward league mean / expanding mean
Bye weeksrest_days feature; don’t fill with zeros blindly
Offseason gapsdon’t treat long rest as a normal short-week rest without care

Validation

Form features are hypotheses. Evaluate alternative windows on identical chronological folds, against a static or simpler baseline.

Tune window/span inside training folds only.


Hard Constraints

  1. No centered rolling windows that peek forward.
  2. No “season average including current game.”
  3. Early-season priors/shrinkage when n is tiny.
  4. Validate across seasons, not one hot streak.
  5. Opponent strength still matters — raw form ≠ opponent-adjusted strength (ratings-strength-models).
  6. Document shift rule in every feature card / experiment log.

Anti-Patterns

  • Fixed 5-game mean with no shrinkage
  • Ignoring opponent strength in raw form
  • Treating playoffs and regular season as identical without a flag
  • Tuning window length on the final test season only
  • Filling NA form with 0.0 silently
  • Claiming “hot streak” causality from one rolling mean

Reporting Template

text
Form model: rolling / EWMA / expanding
Entity/frequency:
Windows/span:
Shift rule: shift(1) before aggregate
Min history:
Validation: vs static baseline under walk-forward
Limits: early season, injuries, opponent strength…
Reproduce:

Output Contract

Done means:

  • Entity/frequency stated
  • Shift/as-of rule stated
  • Window/span documented
  • Min history rule stated
  • Walk-forward comparison planned or done
  • Leakage check planned or done

Worked Example

bash
python /path/to/time-series-sports/scripts/ewma_form.py \
  --input team_games.csv --entity-col team --time-col event_time \
  --order-col event_sequence --group-cols season \
  --values won,point_margin --span 5 \
  --out team_games_with_ewma.csv

python /path/to/time-series-sports/scripts/compare_form_windows.py \
  --input modeling_table.csv --target won --split-col season \
  --features-a pre_roll3_win,pre_roll3_margin \
  --features-b pre_ewma_won,pre_ewma_point_margin

Bundled Resources

references/

FileContents
form_feature_recipes.mdshift/roll/expand/EWMA recipes
early_season.mdsmall-sample handling
rest_and_gaps.mdbyes and calendar gaps

scripts/

FileContents
ewma_form.pyshifted EWMA form table
compare_form_windows.pywalk-forward compare roll vs EWMA features

Related Skills

NeedSkill
Feature legalityfeature-rules
Ratings (opponent-adjusted)ratings-strength-models
EDAeda-sports
Modelsbaseline-models, predictive-modeling
Leakageleakage-audit

Quick Command Card

bash
python /path/to/time-series-sports/scripts/ewma_form.py \
  --input team_games.csv --entity-col team --time-col event_time \
  --order-col event_sequence --group-cols season \
  --values won,point_margin --span 5 \
  --out team_games_with_ewma.csv

python /path/to/time-series-sports/scripts/compare_form_windows.py \
  --input modeling_table.csv --target won --split-col season \
  --features-a pre_roll3_win,pre_roll3_margin \
  --features-b pre_ewma_won,pre_ewma_point_margin

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Time Series Sports làm được gì?

Xây dựng và so sánh các đặc trưng phong độ thể thao bảo đảm không rò rỉ thông tin thời gian. Dùng cho cửa sổ trượt, EWMA, thời gian nghỉ, khoảng cách giữa các trận, xử lý đầu mùa giải và đánh giá theo thứ tự thời gian.

Vì sao nên dùng Time Series Sports trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Time Series Sports là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Time Series Sports trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/WalrusQuant/sports-analytic-skills/tree/main/skills/time-series-sports. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Time Series Sports?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Time Series Sports với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Time Series Sports với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Time Series Sports có miễn phí không?

Kỹ năng này được WalrusQuant phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇