Ml Shapのロゴ

Ml Shap

コミュニティ
From-zero-tohero
ml-shap

Run a complete, leakage-aware machine-learning workflow on CSV or Excel tabular data when the user identifies input features, one output feature, and optionally a date, group, region, or ID column. Use for regression or classification tasks requiring data audits, defensible train/test splitting, baseline and nonlinear model comparison, tuning, out-of-sample evaluation, SHAP interpretation, nonlinear thresholds, interactions, robustness checks, publication-ready figures and tables, a reproducible script, and a written results report.

概要

公開者From-zero-tohero
リポジトリML-SHAP-Skill
スキル名ml-shap
スター
57
フォーク
6
同梱ファイル
3
リンク
  • Markdown形式の指示

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

  • どのLLMでも利用可能

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

  • 3個の同梱ファイル

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

  • オープンソース

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

インストール

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

1

TypingMindにインストール

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

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

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

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/From-zero-tohero/ML-SHAP-Skill.git /tmp/ML-SHAP-Skill
mkdir -p .claude/skills
cp -r /tmp/ML-SHAP-Skill/ml-shap .claude/skills/ml-shap
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

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

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

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

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

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

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

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

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

スキルの指示

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

ML-SHAP

Execute the analysis rather than only describing it. Preserve the source file and write all deliverables to a separate output directory.

Collect the specification

Obtain or infer:

  • source file and worksheet;
  • output column;
  • input columns;
  • regression or classification task;
  • date/time, group, region, and ID columns;
  • forecast horizon if the user means future prediction;
  • positive class and primary metric for classification;
  • research focus, such as a focal variable or expected threshold.

Ask only when a missing choice materially changes the scientific question. Otherwise infer safely and record the assumption.

Audit before modeling

Check schema, sample count, date range, duplicates, missingness, infinities, constant columns, data types, target distribution, category cardinality, outliers, class balance, and suspiciously high target correlations.

Detect leakage explicitly:

  • exclude IDs, post-outcome variables, target-derived fields, and future information;
  • distinguish same-period estimation from genuine forecasting;
  • if a feature is almost identical to the target, retain it only when requested and add an exclusion sensitivity analysis;
  • fit imputers, scalers, encoders, feature selection, and resampling inside the training pipeline only.

Stop and explain if the target is unusable. Otherwise continue.

Choose validation from the data structure

Never default blindly to random splitting.

  • Time or forecast task: sort chronologically, reserve the latest 15–25% as an untouched test set, and tune with expanding-window or rolling validation. Lag predictors according to the forecast horizon.
  • Repeated groups, people, firms, cities, or sites: use group holdout or grouped cross-validation.
  • Spatial generalization: prefer spatial blocks or region holdout.
  • Ordinary IID regression: use shuffled K-fold validation with a fixed seed.
  • IID classification: use stratified splits; use stratified-group validation when both class and group structure exist.

Keep the final test set untouched until model selection is finished. Report exact split dates or group rules.

Build and compare models

Always include a naive baseline and an interpretable linear baseline.

For regression, consider:

  • mean/median or persistence baseline;
  • linear regression, Ridge, or Elastic Net;
  • random forest and Extra Trees;
  • gradient boosting, XGBoost, LightGBM, or CatBoost when available;
  • SVR or neural models only when justified by scale and structure.

For classification, consider:

  • majority or prior baseline;
  • logistic regression;
  • random forest and Extra Trees;
  • gradient boosting, XGBoost, LightGBM, or CatBoost;
  • calibrated probabilities when decisions depend on risk scores.

Tune only competitive model families using the selected cross-validation design. Prefer randomized or Bayesian search to wasteful grids. Fix seeds and limit parallelism when resources are constrained.

Evaluate out of sample

Regression:

  • primary: RMSE or MAE;
  • also report R² and MAE; report MAPE only when targets are safely away from zero;
  • inspect observed-versus-predicted, residual-versus-predicted, residual distribution, and temporal residuals.

Classification:

  • report confusion matrix, precision, recall, F1, ROC-AUC, and PR-AUC;
  • prioritize PR-AUC, recall, or cost-sensitive metrics for imbalance;
  • show ROC, precision–recall, calibration, and threshold-performance plots;
  • never choose a threshold on the final test set.

Report cross-validation mean and dispersion plus untouched-test performance. Diagnose regime shifts, extrapolation failures, and subgroup errors rather than celebrating a single score.

Explain the selected model

Use SHAP when compatible:

  • TreeExplainer for tree ensembles;
  • LinearExplainer for linear models;
  • model-agnostic explainers only with a justified background sample and manageable computation.

Produce explanations in this order:

  1. global mean absolute SHAP importance;
  2. SHAP beeswarm / 蜂群图(蜂巢图) for feature importance, contribution direction, value distribution, and sample heterogeneity;
  3. dependence plots for key variables, with zero line and defensible smoothing;
  4. SHAP interaction values or interaction dependence for important pairs;
  5. waterfall plots for representative, extreme, correct, and failed predictions;
  6. grouped or temporal SHAP summaries when heterogeneity matters.

Explain predictions on validation/test observations, not only training data. State the SHAP background dataset and class explained.

If SHAP cannot be installed or computed, use permutation importance plus PDP/ALE and label these methods accurately. Never call a substitute “SHAP.” Prefer ALE over PDP when predictors are strongly correlated.

Treat all model explanations as predictive associations. Do not use causal language unless a valid causal design or estimator is added.

Read references/figures-and-tables.md when deciding the output set. Read references/quality-gates.md before finalizing.

Run robustness checks

Include checks proportional to the claim:

  • alternative seeds, folds, cut dates, or holdout groups;
  • removal of suspicious or dominant features;
  • alternative model families;
  • reduced versus full feature sets;
  • class weighting or resampling sensitivity;
  • subgroup and regime performance;
  • lag/horizon variants for forecasts;
  • bootstrap confidence intervals when useful.

Do not interpret unstable ranks or thresholds as substantive findings.

Deliver

Create:

  • an Excel workbook containing data audit, descriptive statistics, correlations, split definition, model comparison, best parameters, robustness results, feature importance, thresholds/interactions, and holdout predictions;
  • publication-ready PNG and vector PDF/SVG figures;
  • a concise Markdown or Word report covering methods, results, limitations, and interpretation boundaries;
  • a reproducible Python or R script plus environment/package information;
  • a machine-readable summary JSON when useful.

Lead the final response with the main result and the most important caveat. Link the report, workbook, script, and output directory.


name: ml-shap description: Run a complete, leakage-aware machine-learning workflow on CSV or Excel tabular data when the user identifies input features, one output feature, and optionally a date, group, region, or ID column. Use for regression or classification tasks requiring data audits, defensible train/test splitting, baseline and nonlinear model comparison, tuning, out-of-sample evaluation, SHAP interpretation, nonlinear thresholds, interactions, robustness checks, publication-ready figures and tables, a reproducible script, and a written results report.

ML-SHAP

Execute the analysis rather than only describing it. Preserve the source file and write all deliverables to a separate output directory.

Collect the specification

Obtain or infer:

  • source file and worksheet;
  • output column;
  • input columns;
  • regression or classification task;
  • date/time, group, region, and ID columns;
  • forecast horizon if the user means future prediction;
  • positive class and primary metric for classification;
  • research focus, such as a focal variable or expected threshold.

Ask only when a missing choice materially changes the scientific question. Otherwise infer safely and record the assumption.

Audit before modeling

Check schema, sample count, date range, duplicates, missingness, infinities, constant columns, data types, target distribution, category cardinality, outliers, class balance, and suspiciously high target correlations.

Detect leakage explicitly:

  • exclude IDs, post-outcome variables, target-derived fields, and future information;
  • distinguish same-period estimation from genuine forecasting;
  • if a feature is almost identical to the target, retain it only when requested and add an exclusion sensitivity analysis;
  • fit imputers, scalers, encoders, feature selection, and resampling inside the training pipeline only.

Stop and explain if the target is unusable. Otherwise continue.

Choose validation from the data structure

Never default blindly to random splitting.

  • Time or forecast task: sort chronologically, reserve the latest 15–25% as an untouched test set, and tune with expanding-window or rolling validation. Lag predictors according to the forecast horizon.
  • Repeated groups, people, firms, cities, or sites: use group holdout or grouped cross-validation.
  • Spatial generalization: prefer spatial blocks or region holdout.
  • Ordinary IID regression: use shuffled K-fold validation with a fixed seed.
  • IID classification: use stratified splits; use stratified-group validation when both class and group structure exist.

Keep the final test set untouched until model selection is finished. Report exact split dates or group rules.

Build and compare models

Always include a naive baseline and an interpretable linear baseline.

For regression, consider:

  • mean/median or persistence baseline;
  • linear regression, Ridge, or Elastic Net;
  • random forest and Extra Trees;
  • gradient boosting, XGBoost, LightGBM, or CatBoost when available;
  • SVR or neural models only when justified by scale and structure.

For classification, consider:

  • majority or prior baseline;
  • logistic regression;
  • random forest and Extra Trees;
  • gradient boosting, XGBoost, LightGBM, or CatBoost;
  • calibrated probabilities when decisions depend on risk scores.

Tune only competitive model families using the selected cross-validation design. Prefer randomized or Bayesian search to wasteful grids. Fix seeds and limit parallelism when resources are constrained.

Evaluate out of sample

Regression:

  • primary: RMSE or MAE;
  • also report R² and MAE; report MAPE only when targets are safely away from zero;
  • inspect observed-versus-predicted, residual-versus-predicted, residual distribution, and temporal residuals.

Classification:

  • report confusion matrix, precision, recall, F1, ROC-AUC, and PR-AUC;
  • prioritize PR-AUC, recall, or cost-sensitive metrics for imbalance;
  • show ROC, precision–recall, calibration, and threshold-performance plots;
  • never choose a threshold on the final test set.

Report cross-validation mean and dispersion plus untouched-test performance. Diagnose regime shifts, extrapolation failures, and subgroup errors rather than celebrating a single score.

Explain the selected model

Use SHAP when compatible:

  • TreeExplainer for tree ensembles;
  • LinearExplainer for linear models;
  • model-agnostic explainers only with a justified background sample and manageable computation.

Produce explanations in this order:

  1. global mean absolute SHAP importance;
  2. SHAP beeswarm for magnitude, direction, and heterogeneity;
  3. dependence plots for key variables, with zero line and defensible smoothing;
  4. SHAP interaction values or interaction dependence for important pairs;
  5. waterfall plots for representative, extreme, correct, and failed predictions;
  6. grouped or temporal SHAP summaries when heterogeneity matters.

Explain predictions on validation/test observations, not only training data. State the SHAP background dataset and class explained.

If SHAP cannot be installed or computed, use permutation importance plus PDP/ALE and label these methods accurately. Never call a substitute “SHAP.” Prefer ALE over PDP when predictors are strongly correlated.

Treat all model explanations as predictive associations. Do not use causal language unless a valid causal design or estimator is added.

Read references/figures-and-tables.md when deciding the output set. Read references/quality-gates.md before finalizing.

Run robustness checks

Include checks proportional to the claim:

  • alternative seeds, folds, cut dates, or holdout groups;
  • removal of suspicious or dominant features;
  • alternative model families;
  • reduced versus full feature sets;
  • class weighting or resampling sensitivity;
  • subgroup and regime performance;
  • lag/horizon variants for forecasts;
  • bootstrap confidence intervals when useful.

Do not interpret unstable ranks or thresholds as substantive findings.

Deliver

Create:

  • an Excel workbook containing data audit, descriptive statistics, correlations, split definition, model comparison, best parameters, robustness results, feature importance, thresholds/interactions, and holdout predictions;
  • publication-ready PNG and vector PDF/SVG figures;
  • a concise Markdown or Word report covering methods, results, limitations, and interpretation boundaries;
  • a reproducible Python or R script plus environment/package information;
  • a machine-readable summary JSON when useful.

Lead the final response with the main result and the most important caveat. Link the report, workbook, script, and output directory.

同梱ファイル

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

よくある質問

AIスキル「Ml Shap」では何ができますか?

Run a complete, leakage-aware machine-learning workflow on CSV or Excel tabular data when the user identifies input features, one output feature, and optionally a date, group, region, or ID column. Use for regression or classification tasks requiring data audits, defensible train/test splitting, baseline and nonlinear model comparison, tuning, out-of-sample evaluation, SHAP interpretation, nonlinear thresholds, interactions, robustness checks, publication-ready figures and tables, a reproducible script, and a written results report.

TypingMindでMl Shapを使うメリットは何ですか?

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

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

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

Ml Shapを使えるAIモデルはどれですか?

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

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

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

AIスキル「Ml Shap」は無料ですか?

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

AIスキルとは何ですか?

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

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

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

すべて見る

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

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