Datarobot Model Explainabilityのロゴ

Datarobot Model Explainability

組織
datarobot-oss
datarobot-model-explainability

Tools and guidance for model explainability, prediction explanations, feature impact analysis, SHAP values, SHAP distributions, anomaly assessment, and model diagnostics. Use when analyzing model explanations, feature impact, SHAP values, SHAP distributions, anomaly assessment, or diagnosing model behavior.

概要

公開者datarobot-oss
リポジトリdatarobot-agent-skills
スキル名datarobot-model-explainability
スター
33
フォーク
27
同梱ファイル
3
ライセンスApache-2.0
リンク
  • Markdown形式の指示

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

  • どのLLMでも利用可能

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

  • 3個の同梱ファイル

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

  • オープンソース

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

インストール

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

1

TypingMindにインストール

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

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

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

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

Claude Code — .claude/skills
git clone --depth 1 https://github.com/datarobot-oss/datarobot-agent-skills.git /tmp/datarobot-agent-skills
mkdir -p .claude/skills
cp -r /tmp/datarobot-agent-skills/skills/datarobot-model-explainability .claude/skills/datarobot-model-explainability
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

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

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

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

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

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

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

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

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

スキルの指示

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

DataRobot Model Explainability Skill

This skill covers SHAP insights, XEMP prediction explanations, anomaly explanations, and model diagnostics.

SDK version: Use datarobot>=3.6.0 for the full API set in this skill (ShapDistributions was added in 3.6; ShapMatrix, ShapImpact, and ShapPreview are available in datarobot>=3.4.0). Use from datarobot.insights import ShapMatrix, ... with entity_id=model_id — not legacy datarobot.models.ShapMatrix (project_id / dataset_id). ShapMatrix, ShapImpact, ShapPreview, and ShapDistributions are the canonical SHAP API. The older dr.PredictionExplanations (XEMP-based) remains available but is the secondary path.


Quick Start

GoalAPI to usePrerequisites
SHAP values for all features, all rowsShapMatrix.create(entity_id=model_id)None - universal SHAP
Per-row top-feature explanationsShapPreview.create(entity_id=model_id)None
Aggregated feature importance via SHAPShapImpact.create(entity_id=model_id)None
SHAP value distributions across featuresShapDistributions.create(entity_id=model_id)None
SHAP for a filtered segmentdr.DataSlice.create(...) + ShapMatrix.create(..., data_slice_id=...)Data slice definition
XEMP-based prediction explanationsdr.PredictionExplanations.create(...)Feature Impact; PE initialization; dataset uploaded
Anomaly explanations (time series)AnomalyAssessmentRecord.compute(project_id, model_id, ...)Anomaly model
ROC / lift / confusion (insights)RocCurve.create(...) / LiftChart.create(...) / ConfusionMatrix.create(...)Validation data
ROC / lift / confusion (Model helpers)model.get_roc_curve() / model.get_lift_chart() / model.get_confusion_chart()Validation data

Universal SHAP is the preferred path - no dataset pre-upload or Feature Impact step required.

When to use this skill

Use this skill when you need to explain leaderboard model behavior, compute SHAP insights, use XEMP prediction explanations, analyze anomaly explanations, or retrieve model diagnostics.

Key capabilities

1. SHAP insights

  • Compute ShapMatrix, ShapPreview, ShapImpact, and ShapDistributions
  • Filter insights with dr.DataSlice

2. XEMP and anomaly explanations

  • Use XEMP dr.PredictionExplanations when specifically required
  • Retrieve time series anomaly assessment records and explanations

3. Diagnostics

  • Retrieve ROC, lift, and confusion insights
  • Use Model helpers for ROC, lift, confusion, and feature effects

Setup

python
import datarobot as dr
from datarobot.insights import ShapMatrix, ShapImpact, ShapPreview, ShapDistributions

dr.Client()

Core API: datarobot.insights

python
import pandas as pd
from datarobot.insights import ShapMatrix, ShapImpact, ShapPreview, ShapDistributions

model_id = "YOUR_MODEL_ID"

matrix = ShapMatrix.create(entity_id=model_id)
df = pd.DataFrame(matrix.matrix, columns=matrix.columns)

impact = ShapImpact.create(entity_id=model_id)
preview = ShapPreview.create(entity_id=model_id)
distributions = ShapDistributions.create(entity_id=model_id)

Use ShapMatrix for full row-by-feature SHAP values, ShapPreview for compact top-driver rows, ShapImpact for aggregated SHAP importance, and ShapDistributions for per-feature SHAP distributions. Use source="externalTestSet" plus external_dataset_id for external datasets. See references/shap_api_reference.md for parameters, exports, and limitations.


Secondary path: XEMP Prediction Explanations

Use dr.PredictionExplanations when XEMP explanations are specifically required (e.g., certain regulatory contexts, or when SHAP is unavailable for the model type).

Prerequisites (all required before calling .create()):

  1. Feature Impact must be computed: model.request_feature_impact() and wait
  2. Prediction explanations initialized: dr.PredictionExplanationsInitialization.create(...)
  3. Scoring dataset uploaded to the AI Catalog
python
import datarobot as dr

model = dr.Model.get(project=project_id, model_id=model_id)
model.request_feature_impact().wait_for_completion()
dr.PredictionExplanationsInitialization.create(project_id=project_id, model_id=model_id)

dataset = dr.Dataset.upload("./data/scoring_data.csv")
pe_job = dr.PredictionExplanations.create(
    project_id=project_id,
    model_id=model_id,
    dataset_id=dataset.id,
    max_explanations=5,  # top N features per row, up to 50
    threshold_high=0.5,  # only explain rows with prediction >= threshold
    threshold_low=0.1,  # only explain rows with prediction <= threshold
)

pe_obj = pe_job.get_result_when_complete()

Use pe_obj.get_rows(), pe_obj.get_all_as_dataframe(), or pe_obj.download_to_csv(...) to retrieve results. For parameters, multiclass modes, and exposure-adjusted predictions, see references/xemp_pe_reference.md.

Data slices for filtered insights

Use dr.DataSlice when the user asks to explain model behavior for a segment, such as a region, product line, target class, or high-risk cohort. Pass the resulting data_slice_id into the datarobot.insights SHAP APIs.

python
import datarobot as dr
from datarobot.insights import ShapMatrix

data_slice = dr.DataSlice.create(
    name="high_income_customers",
    filters=[{"operand": "income", "operator": ">", "values": 100000}],
    project=project_id,
)

shap_matrix = ShapMatrix.create(
    entity_id=model_id,
    source="validation",
    data_slice_id=data_slice.id,
)

Anomaly assessment (time series models)

For time series anomaly detection models, use AnomalyAssessmentRecord.

python
from datarobot.models.anomaly_assessment import AnomalyAssessmentRecord

record = AnomalyAssessmentRecord.compute(
    project_id=project_id,
    model_id=model_id,
    backtest=0,  # backtest index (int) or "holdout"
    source="validation",  # "training" or "validation" only
    series_id=None,  # required for multiseries projects
)

records = AnomalyAssessmentRecord.list(project_id=project_id, model_id=model_id)
latest = record.get_latest_explanations()

regions = record.get_predictions_preview().find_anomalous_regions()
explanations = record.get_explanations_data_in_regions(regions=regions)

ranged = record.get_explanations(
    start_date="2024-01-01T00:00:00.000000Z",
    end_date="2024-06-01T00:00:00.000000Z",
)

Model diagnostics

Use the same entity_id=model_id pattern as SHAP insights. FeatureEffects / partial dependence is still retrieved through Model helpers (not in datarobot.insights).

Insights diagnostics (preferred — matches SHAP API)

python
from datarobot.insights import RocCurve, LiftChart, ConfusionMatrix

roc = RocCurve.create(entity_id=model_id)
lift = LiftChart.create(entity_id=model_id)
confusion = ConfusionMatrix.create(entity_id=model_id)

Model helpers (alternative)

python
model = dr.Model.get(project=project_id, model_id=model_id)

roc = model.get_roc_curve(source="validation")
lift = model.get_lift_chart(source="validation")
confusion = model.get_confusion_chart(source="validation")

# Feature Impact (non-SHAP) and Feature Effects (partial dependence for top features)
fi = model.get_feature_impact()
feature_effects = model.get_feature_effect(source="validation")

Interpreting SHAP values

  • Positive value: feature pushes prediction higher than baseline
  • Negative value: feature pushes prediction lower than baseline
  • Magnitude: size of influence; larger absolute value = stronger effect
  • Sum: all SHAP values for a row sum to prediction - base_value in the link-function space
  • base_value: the model's mean prediction (the "no information" baseline)

Example: if base_value = 0.35 and a row's prediction is 0.72, the row's SHAP values sum to 0.37 when link_function = "identity". A feature with SHAP +0.20 contributed 20 units in that same link-function space above baseline.

When link_function = "logit", SHAP values are in log-odds space. Add feature contributions to base_value in log-odds space, then use inverse-logit (scipy.special.expit) on the resulting total to convert it to a probability. Do not apply expit to individual SHAP values as if they were probability deltas.


Decision guide

Task: explain predictions
    |
    - Need all features + all rows?     -> ShapMatrix.create(entity_id=model_id)
    - Need top-N features per row?      -> ShapPreview.create(entity_id=model_id)
    - Need aggregated importance?       -> ShapImpact.compute(entity_id=model_id)
    - Need feature SHAP distributions?  -> ShapDistributions.create(entity_id=model_id)
    - Need a segment/cohort only?       -> dr.DataSlice + data_slice_id
    - XEMP required (regulatory/type)?  -> dr.PredictionExplanations.create(...)
    - Time series / anomaly model?      -> AnomalyAssessmentRecord.compute(project_id, model_id, ...)

Common errors

ErrorCauseFix
SHAP not available for this modelUnsupported model type, or anomaly-detection model with >1000 featuresCheck model support; use XEMP PE if SHAP is unavailable
Feature Impact not computedPredictionExplanations prerequisite missingRun model.request_feature_impact() and wait
Missing PredictionExplanationsInitializationPE not initializedCall PredictionExplanationsInitialization.create()
source='holdout' failsHoldout not unlockedUnlock holdout in project settings first
Empty previewsNo rows in partitionCheck partition contains data

Reference files

  • references/shap_api_reference.md - full parameter signatures for ShapMatrix, ShapImpact, ShapPreview, ShapDistributions
  • references/xemp_pe_reference.md - PredictionExplanations and PredictionExplanationsInitialization parameter reference
  • scripts/compute_shap_matrix.py - compute and export ShapMatrix to CSV or DataFrame

Resources

同梱ファイル

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

よくある質問

AIスキル「Datarobot Model Explainability」では何ができますか?

Tools and guidance for model explainability, prediction explanations, feature impact analysis, SHAP values, SHAP distributions, anomaly assessment, and model diagnostics. Use when analyzing model explanations, feature impact, SHAP values, SHAP distributions, anomaly assessment, or diagnosing model behavior.

TypingMindでDatarobot Model Explainabilityを使うメリットは何ですか?

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

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

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

Datarobot Model Explainabilityを使えるAIモデルはどれですか?

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

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

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

AIスキル「Datarobot Model Explainability」は無料ですか?

はい。datarobot-ossがApache-2.0ライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

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

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

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

すべて見る

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

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