Time Series Sportsのロゴ

Time Series Sports

コミュニティ
WalrusQuant
time-series-sports

時間の整合性を保ったスポーツの調子に関する特徴量を作成し、比較します。ローリングウィンドウ、EWMA、休養日程、試合間隔、シーズン序盤の扱い、時系列順の評価に使用します。

Add to TypingMind

概要

公開者WalrusQuant
リポジトリsports-analytic-skills
スキル名time-series-sports
スター
53
フォーク
4
同梱ファイル
5
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 5個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    WalrusQuantがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Time Series Sports」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/WalrusQuant/sports-analytic-skills/tree/main/skills/time-series-sports
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをその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
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでTime Series Sportsを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にTime Series Sportsを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Time Series Sportsは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

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

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Time Series Sports」では何ができますか?

時間の整合性を保ったスポーツの調子に関する特徴量を作成し、比較します。ローリングウィンドウ、EWMA、休養日程、試合間隔、シーズン序盤の扱い、時系列順の評価に使用します。

TypingMindでTime Series Sportsを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Time Series Sportsはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにTime Series Sportsをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/WalrusQuant/sports-analytic-skills/tree/main/skills/time-series-sportsを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Time Series Sportsを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Time Series Sportsで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもTime Series Sportsを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Time Series Sports」は無料ですか?

WalrusQuantがGitHubで公開しています。ライセンス条件はリポジトリでご確認ください。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇