Leakage Auditのロゴ

Leakage Audit

コミュニティ
WalrusQuant
leakage-audit

スポーツモデリングのテーブルやワークフローを監査し、目的変数、時間、結合、前処理、データ分割に関するリークを検出します。バックテストや報告された予測性能を信頼する前に使用します。

Add to TypingMind

概要

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

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

  • どのLLMでも利用可能

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

  • 5個の同梱ファイル

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

  • オープンソース

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

インストール

AIスキル「Leakage Audit」を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/leakage-audit
  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/leakage-audit .claude/skills/leakage-audit
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

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

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

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

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

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

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

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

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

スキルの指示

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

Leakage Audit

Outcome and stance

Assume leakage until the pipeline proves time-safe. Produce an adversarial, evidence-backed verdict: CLEAN, REVIEW REQUIRED, or NOT CLEAN, with contaminated fields, affected claims, required repairs, and retest conditions. A strong metric is never evidence of cleanliness.

When to Use This Skill

Use when:

  • trusting a backtest or “good” metric for the first time;
  • reviewing a feature table before modeling or after a suspiciously strong result;
  • auditing target aliases, joins, shifts, preprocessing, or split design;
  • the user says the model looks too good / results are unexpected.

Do not use this skill as a substitute for:

  • designing legal features from scratch → feature-rules;
  • designing folds and metrics → validation-design;
  • first-pass panel EDA → eda-sports.
NeedGo instead
Feature construction rulesfeature-rules
Fold / metric chartervalidation-design
Probability reliability after clean designcalibration-check

Lock the audit contract

Before inspecting correlations or metrics, write the target, row grain, exact prediction decision time T, eligible population, source publication/revision policy, and intended validation split. If T is ambiguous, the audit cannot pass.

Use the audit checklist during every audit. Consult the leakage-pattern catalog while tracing failure modes and the case studies when performance or a join looks implausible.

Audit sequence

  1. Trace the target to its source and identify aliases, transformations, proxies, and duplicated labels.
  2. Inventory every candidate feature, raw source, event/publication/revision time, and availability at T.
  3. Inspect temporal transforms for stable sort and shift-before-roll/expand.
  4. Trace opponent, roster, injury, rating, weather, price, and schedule joins.
  5. Verify preprocessing, selection, encoding, and tuning fit only on training rows.
  6. Verify validation moves forward in time and related rows remain together.
  7. Run automated matrix heuristics, then manually investigate every finding.
  8. Reproduce suspicious rows and performance jumps from raw inputs.
  9. Issue the verdict and block unsupported claims until repair and rerun.

Leakage catalog

PatternExampleEvidence to inspectRepair
Target aliaswon, margin sign, final ranklineage and exact/near correlationremove from inputs
Same-event contaminationcurrent score, EPA, box totalssource/event timestampstarget-only or redefine T
Unshifted historycurrent result in rolling meantransform order and boundary rowsshift, then aggregate
Season bleedfinal season average on week 2snapshot/publication policyexpanding prior value
Opponent contaminationopponent total includes matchupjoin trace and paired rowsjoin safe opponent priors
Revision leakagecorrected stat used historicallypublication/revision timestampsreconstruct as-of vintage
Random row splitfuture games in trainfold date rangesforward-only split
Group leakagetwo game perspectives split apartgame/entity membershipgroup related rows
Preprocessing leakscaler/encoder fit globallyfitted-object lineagefit in training fold
Tuning leakfinal fold drives hyperparametersexperiment historynested tuning/untouched holdout
Duplicate leakagesame event or player appears in bothhashes and keysdeduplicate/group before split

Manual review

Target and time

  • Is the target post-T by definition, and are canceled/tied/incomplete events handled?
  • Are prediction timestamps stored or reconstructable rather than assumed?
  • Which provider fields are revised, and which historical vintage is used?
  • Could a feature name be harmless while its source table is post-event?

Transformations

python
ordered = df.sort_values(["team", "event_time", "game_id"])
expected = ordered.groupby("team")["won"].transform(
    lambda s: s.shift(1).expanding(min_periods=1).mean()
)
assert expected.equals(ordered["pre_win_pct"])

Check sort tie-breaks, reset boundaries, offseason carryover, minimum periods, and whether the first entity event has an unexplained empirical prior. A future perturbation test should prove that changing later outcomes cannot alter earlier features.

Joins

For every join, document left/right grain, keys, expected cardinality, publication-time predicate, unmatched rate, duplicate rate, and fields retained. An as-of join must be backward-looking and satisfy right_published_at <= T. Display-name joins and silent many-to-many expansion are audit failures until resolved. Opponent features must equal the opponent's own pre-event row.

Splits and preprocessing

For every fold prove train max time < test min time, allowing only the declared gap/embargo. Keep paired team-game rows, repeated observations from the same event, and other dependency groups together when the estimand requires it. Imputers, scalers, encoders, selectors, target encoders, PCA, early stopping, and hyperparameter search must see training data only.

Too-good triggers

Near-perfect accuracy, implausibly low log-loss/error, a dramatic single-feature jump, train/test equality, or a result far beyond domain baselines triggers a stop. Recheck target aliases, current-event fields, shifts, opponent joins, duplicates, global preprocessing, and test-fold tuning before discussing merit.

Automated helpers

The audit helper reads a user-owned CSV, Parquet, JSON, JSONL, or NDJSON table, requires pandas, validates named columns, and runs name, exact-target, duplicate, and near-perfect-correlation heuristics.

bash
python /path/to/leakage-audit/scripts/audit_pregame_features.py \
  --input modeling_table.csv --target won \
  --features pre_win_rate,rest_diff,rating_diff \
  --entity-col team --time-col event_time --out leakage.json

python /path/to/leakage-audit/scripts/write_audit_stub.py \
  --out data/leakage_audit.md

Use --banned to provide exact forbidden names for the task. The first-event null-rate check is always REVIEW, not PASS, because legitimate priors can populate first events. Duplicate rows and near-perfect correlations are also REVIEW: they are suspicious, not proof by themselves. A direct forbidden or target-identical feature returns NOT CLEAN and status 2. Otherwise the helper returns REVIEW REQUIRED and status 1: heuristics alone never return CLEAN. Only a completed manual audit of lineage, transforms, joins, splits, and fold-local preprocessing can issue the CLEAN verdict.

Exit codes (not crashes)

ExitVerdictAgent action
1REVIEW REQUIREDContinue. Read the JSON. Complete the manual audit. Do not treat this as a hard failure.
2NOT CLEANStop predictive claims until repaired and retested.
0unusedHeuristics never auto-CLEAN.

Stderr also prints exit=1 REVIEW REQUIRED... or exit=2 NOT CLEAN... so a cold agent does not mistake a review signal for a broken script.

Automated checks cannot prove source availability, transform correctness, join direction, or fold scope. They supplement—not replace—lineage and code review.

Diagnosis examples

Rolling form without a shift: manually recomputation shows row i contains its own result. Mark NOT CLEAN, rebuild with shift(1), regenerate all downstream artifacts, and rerun validation.

Final-season efficiency on early games: the value is constant within season and reflects later games. Replace with an expanding as-of statistic from prior events; do not merely drop the first weeks.

Legitimate first-event prior: first rows have non-null ratings, but lineage shows a fixed preseason rating published before T. Keep REVIEW REQUIRED until the initialization and timestamp are documented, then pass that item.

Random K-fold with clean features: feature checks pass but future seasons enter training. The pipeline is still NOT CLEAN; redesign folds and rerun all reported metrics.

Verdict rules

VerdictMeaning
CLEANcomplete inventory reviewed; no unresolved violations or review items
REVIEW REQUIREDno proven contamination, but evidence or availability is incomplete
NOT CLEANat least one feature, join, transform, split, or tuning path uses forbidden information

Uncertainty is not CLEAN. A fixed matrix must be regenerated and reevaluated; deleting a suspicious column after scoring does not rescue prior metrics.

Audit report template

text
Leakage audit
Sport / question / target / grain:
Decision time T and publication policy:
Data snapshot and feature count:
Validation and grouping rule:
Automated helper result / exit status:
Lineage and transform evidence reviewed:
Findings:
  1. [PASS | REVIEW | FAIL] item, evidence, affected scope
Contaminated fields/artifacts:
Required repairs and retests:
Remaining uncertainty:
Verdict: CLEAN | REVIEW REQUIRED | NOT CLEAN
Auditor / date:

Integrity and resource routing

  1. Prefer a false review to a false clean; never infer cleanliness from metrics.
  2. Timeline sort in the audit must match construction exactly.
  3. Do not repair leakage by dropping a bad test period or redefining success.
  4. NOT CLEAN blocks predictive claims until rebuilt and retested.
  5. Use references/audit_checklist.md for completion, references/leakage_patterns.md for taxonomy, and references/case_studies.md for diagnosis.
  6. Pair with feature-rules for remediation and validation-design for folds.

同梱ファイル

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

よくある質問

AIスキル「Leakage Audit」では何ができますか?

スポーツモデリングのテーブルやワークフローを監査し、目的変数、時間、結合、前処理、データ分割に関するリークを検出します。バックテストや報告された予測性能を信頼する前に使用します。

TypingMindでLeakage Auditを使うメリットは何ですか?

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

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

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

Leakage Auditを使えるAIモデルはどれですか?

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

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

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

AIスキル「Leakage Audit」は無料ですか?

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

AIスキルとは何ですか?

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

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

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

すべて見る
affaan-mのロゴ

Content Engine

affaan-m
コミュニティ人気

X、LinkedIn、TikTok、YouTube、ニュースレター向けのコンテンツ制作の仕組みや、複数プラットフォーム向けキャンペーンを作成します。SNS投稿、スレッド、台本、コンテンツカレンダーの作成や、1つの素材を各プラットフォームに合わせて調整したい場合に使います…

40.4K
270.2K
1ファイル
表示
affaan-mのロゴ

Crosspost

affaan-m
コミュニティ人気

X、LinkedIn、Threads、Blueskyを横断してコンテンツを配信します。content-engineのパターンを使って各プラットフォーム向けに調整し、同じ内容をそのまま投稿することはありません。SNS全体にコンテンツを配信したい場合に使います…

40.4K
270.2K
1ファイル
表示
affaan-mのロゴ

Deep Research

affaan-m
コミュニティ人気

firecrawlとexaのMCPを使って複数の情報源を詳細に調査します。ウェブ検索、調査結果の統合、出典を明記したレポート作成を行います。根拠と引用を含む綿密な調査が必要な場合に使います…

40.4K
270.2K
1ファイル
表示
affaan-mのロゴ

Documentation Lookup

affaan-m
コミュニティ人気

学習データではなくContext7 MCPで、ライブラリやフレームワークの最新ドキュメントを参照します。セットアップ、APIリファレンス、コード例、Reactなどのフレームワークについて尋ねられたときに有効になります…

40.4K
270.2K
1ファイル
表示

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

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