[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6MB57EFJXG4YPK0W6MG6KST":3,"skill-same:01M6MB57EFJXG4YPK0W6MG6KST":114},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":50,"commitSha":51,"skillDirectory":52,"forksCount":53,"repositoryHtmlUrl":54,"repositoryHomepageUrl":55,"ownerHtmlUrl":56,"ownerBlogUrl":57,"ownerDescription":58,"updatedAt":59,"install":60,"resources":73},"01M6MB57EFJXG4YPK0W6MG6KST","shap",null,"Explain and audit machine-learning predictions with SHAP. Use for selecting SHAP explainers and maskers, computing and validating feature attributions, handling multi-output explanations, and producing local or global SHAP visualizations.","hashgraph-online\u002Fawesome-codex-plugins","hashgraph-online","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F160371962?v=4","01M6CNB6NRJVNNGN14TR01Q6D3","HOL (Hashgraph Online)","01M6JT1HSKKG9V68KQAQGBA7XP",1575,"MIT","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fshap\u002FSKILL.md",[],[5,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"model","for","Interpretability","machine","data-science","predictions","feature","local","uv","read","python","learning","visualizations","Bash","data","attribution","audit","libraries","machine learning","2026-11-10 10:12:30",false,"---\nname: shap\ndescription: Explain and audit machine-learning predictions with SHAP. Use for selecting SHAP explainers and maskers, computing and validating feature attributions, handling multi-output explanations, and producing local or global SHAP visualizations.\nlicense: MIT\ncompatibility: Requires Python 3.12+ and uv for SHAP 0.52.0; model-specific libraries are optional.\nallowed-tools: Read Bash\nmetadata:\n  version: '2.1'\n  category: data-science-and-ml\n  maintainer: Kalaris Labs\n  tags: explainable AI, SHAP, feature attribution, model interpretability, machine learning\n---\n\n# SHAP\n\nUse SHAP to describe how a fitted predictive model maps inputs to outputs. Work from the modern `shap.Explanation` API, make the explained output and background distribution explicit, and validate every explanation before interpreting it.\n\nThis skill is aligned with **SHAP 0.52.0** (released 2026-05-28). That release requires Python 3.12 or newer.\n\n## Operating Rules\n\n1. Explain a fixed, evaluated model; do not use SHAP as a substitute for predictive validation.\n2. Use held-out or clearly labeled analysis rows for explanations. Choose background rows only from an appropriate training or reference population.\n3. State the explained output: regression value, raw margin, probability, log loss, logit, or another model method.\n4. Keep explanations as `shap.Explanation` objects. Call `explainer(X)`; use `.shap_values(X)` only when maintaining legacy code.\n5. For multi-output models, select one output before using tabular plots: `explanation[..., output_index]`.\n6. Check `base_values + values.sum(...)` against the exact model output being explained.\n7. Treat SHAP as a description of model behavior under a masking\u002Fbackground choice. It does not establish causality, fairness, recourse, or scientific mechanism.\n8. Never silence an additivity failure until input shape, preprocessing, model version, output space, and row ordering have been checked.\n9. Do not load untrusted pickle, joblib, model, or explainer artifacts; those formats can execute code during deserialization.\n\n## Install\n\nCreate an isolated environment and pin the documented release:\n\n```bash\nuv venv --python 3.12\nsource .venv\u002Fbin\u002Factivate\nuv pip install \"shap[plots]==0.52.0\"\n```\n\n`shap[plots]` installs the plotting dependencies. Add the fitted model's package at a version compatible with the project. For older Python compatibility, read [references\u002Fmigration.md](references\u002Fmigration.md) instead of silently installing a different SHAP release.\n\nConfirm the environment before debugging an API mismatch:\n\n```python\nimport platform\nimport shap\n\nprint(\"Python:\", platform.python_version())\nprint(\"SHAP:\", shap.__version__)\n```\n\n## Standard Workflow\n\n### 1. Define the explanation target\n\nRecord:\n\n- model and preprocessing version;\n- exact callable or model method being explained;\n- output name\u002Findex and units;\n- evaluation rows;\n- background\u002Freference population;\n- masker and explainer algorithm;\n- SHAP and model-library versions.\n\nFor classifiers, decide whether the task needs raw margins or probabilities. Defaults differ by model family; never infer units from the plot color or sign.\n\n### 2. Select an explainer and masker\n\nStart with `shap.Explainer(model, masker)` when automatic dispatch is sufficient. Instantiate a specialized explainer when its assumptions or output controls matter.\n\n| Situation | Preferred choice | Important constraint |\n|---|---|---|\n| Supported tree ensemble | `TreeExplainer` | `model_output=\"probability\"` and `\"log_loss\"` require interventional masking and background data |\n| Linear model | `LinearExplainer` | The masker determines interventional versus correlation-aware behavior |\n| Small feature space | `ExactExplainer` | Cost grows quickly with unconstrained feature count |\n| General tabular callable | `PermutationExplainer` | Budget at least one full forward\u002Freverse permutation |\n| Hierarchical feature groups, text, or image | `PartitionExplainer` | The partition tree changes the cooperative game |\n| Differentiable neural network | `DeepExplainer` or `GradientExplainer` | Framework support, output shape, and background choice require testing |\n| Legacy Kernel SHAP workflow | `KernelExplainer` | Usually much slower than model-specific methods |\n\nUse the detailed decision guide in [references\u002Fexplainers.md](references\u002Fexplainers.md). Use [references\u002Fdata-maskers.md](references\u002Fdata-maskers.md) when features are correlated, structured, sparse, or semantically grouped.\n\n### 3. Compute a modern `Explanation`\n\nThis complete binary-classification example uses an explicit background and selects the positive-class output:\n\n```python\nimport numpy as np\nimport shap\nfrom sklearn.datasets import load_breast_cancer\nfrom sklearn.ensemble import RandomForestClassifier\nfrom sklearn.model_selection import train_test_split\n\nX, y = load_breast_cancer(as_frame=True, return_X_y=True)\nX_train, X_test, y_train, y_test = train_test_split(\n    X,\n    y,\n    test_size=0.2,\n    stratify=y,\n    random_state=7,\n)\n\nmodel = RandomForestClassifier(\n    n_estimators=200,\n    min_samples_leaf=3,\n    random_state=7,\n    n_jobs=-1,\n).fit(X_train, y_train)\n\nbackground = shap.sample(X_train, 100, random_state=7)\nexplainer = shap.Explainer(model, background, algorithm=\"tree\")\nall_outputs = explainer(X_test)\n\n# sklearn tree classifiers expose one output per class.\npositive = all_outputs[..., 1]\nassert positive.values.shape == X_test.shape\n\nreconstructed = np.asarray(positive.base_values) + positive.values.sum(axis=1)\nexpected = model.predict_proba(X_test)[:, 1]\nnp.testing.assert_allclose(reconstructed, expected, rtol=1e-5, atol=1e-6)\n\nshap.plots.beeswarm(positive, max_display=15)\nshap.plots.waterfall(positive[0], max_display=15)\n```\n\nOutput shape is model-dependent:\n\n- one tabular output: `(samples, features)`;\n- multiple tabular outputs: `(samples, features, outputs)`;\n- multiple model inputs: often a list of arrays or explanations;\n- image\u002Ftext explanations: feature axes follow the input representation, with output selection on the final axis when present.\n\nDo not use the pre-0.45 pattern `values[class_index]` for a modern multi-output array. Use `values[..., class_index]` or slice the `Explanation` itself.\n\n### 4. Control tree output semantics when needed\n\nFor a supported tree classifier, probability-space explanations must be explicit:\n\n```python\nbackground = shap.sample(X_train, 200, random_state=7)\n\nexplainer = shap.TreeExplainer(\n    model,\n    data=background,\n    feature_perturbation=\"interventional\",\n    model_output=\"probability\",\n)\nprobability_exp = explainer(X_test)\n```\n\nIn SHAP 0.52:\n\n- `feature_perturbation=\"auto\"` uses interventional semantics when background data is supplied and tree-path-dependent semantics otherwise;\n- probability and log-loss output modes are supported only with interventional semantics;\n- pass `approximate=True` to `explainer(X, approximate=True)` if deliberately using the lower-fidelity tree approximation; do not pass it to the constructor.\n\n### 5. Use a model-agnostic callable deliberately\n\nPass the exact callable whose outputs will be interpreted:\n\n```python\nmasker = shap.maskers.Independent(background, max_samples=100)\nexplainer = shap.Explainer(\n    model.predict_proba,\n    masker,\n    algorithm=\"permutation\",\n    output_names=[str(label) for label in model.classes_],\n    seed=7,\n)\n\nbudget = 2 * X_test.shape[1] + 1\nall_outputs = explainer(X_test.iloc[:20], max_evals=budget)\npositive = all_outputs[..., 1]\n```\n\nIncrease `max_evals` to average over more permutations when estimates are unstable. Keep the seed, background sample, and evaluation budget in the report.\n\n### 6. Visualize the question, not merely the available plot\n\n| Question | Plot |\n|---|---|\n| Which features have the largest average attribution magnitude? | `shap.plots.bar(exp)` |\n| How do direction, magnitude, and observed values vary globally? | `shap.plots.beeswarm(exp)` |\n| Why did one prediction differ from its baseline? | `shap.plots.waterfall(exp[i])` |\n| How does one feature's attribution vary over its values? | `shap.plots.scatter(exp[:, feature])` |\n| Do explanations form sample-level patterns? | `shap.plots.heatmap(exp)` |\n| How do predefined cohorts differ descriptively? | `shap.plots.bar(exp.cohorts(labels).abs.mean(0))` |\n| Which tokens or image regions contribute to an output? | `shap.plots.text(exp)` or `shap.plots.image(exp)` |\n\nRead [references\u002Fplots.md](references\u002Fplots.md) before customizing or saving figures.\n\n### 7. Report limitations with results\n\nAt minimum, report:\n\n- output and units;\n- baseline\u002Freference population;\n- explainer and masker;\n- sample count and selection;\n- output index\u002Fname;\n- additivity error or applicable approximation diagnostics;\n- known correlated\u002Fgrouped features;\n- whether results are local, aggregated, or cohort-specific;\n- a clear non-causal statement.\n\n## Common Tasks\n\n### Global and local analysis\n\nUse global plots to locate important patterns, scatter plots to inspect those patterns, and local plots to investigate selected rows. Do not select only visually dramatic rows without documenting the selection rule.\n\n### Multiclass models\n\nSet `output_names` where possible, inspect `explanation.output_names`, and slice an output before plotting:\n\n```python\nclass_exp = explanation[..., \"class_name\"]\n# or\nclass_exp = explanation[..., class_index]\n```\n\nNever average signed attributions across classes. For cross-class comparison, preserve the same model, rows, background, output space, and aggregation.\n\n### Cohorts, subgroup analysis, and fairness\n\nSHAP can compare how a model uses features across cohorts, but this is not a fairness test. A protected feature with small SHAP magnitude does not rule out proxy discrimination, and removing a protected feature does not establish fairness. Pair attribution analysis with performance, calibration, error-rate, and domain-appropriate fairness metrics.\n\nSee [references\u002Fworkflows.md](references\u002Fworkflows.md) for cohort construction, model comparison, error analysis, log-loss explanations, monitoring, and production records.\n\n### Text and images\n\nUse domain maskers rather than treating tokens or pixels as ordinary independent columns:\n\n- `shap.maskers.Text(tokenizer)` with `PartitionExplainer` for token groups;\n- `shap.maskers.Image(...)` with `PartitionExplainer` for image regions;\n- restrict expensive multi-output models with `outputs=...`.\n\nRead [references\u002Fmodalities.md](references\u002Fmodalities.md) for current examples and output-shape guidance.\n\n## Troubleshooting Order\n\n1. Print Python, SHAP, model-library, NumPy, and framework versions.\n2. Verify the model receives exactly the same transformed columns, order, dtype, and missing-value representation used during fitting.\n3. Print `values.shape`, `base_values.shape`, `data.shape`, `feature_names`, and `output_names`.\n4. Confirm the selected output and output units.\n5. Recompute predictions on the same rows in the same order.\n6. Test a smaller batch and representative background.\n7. Only then investigate package-specific compatibility or approximation settings.\n\nUse [references\u002Ftroubleshooting.md](references\u002Ftroubleshooting.md) for additivity failures, shape mismatches, categorical features, pipelines, deep-learning frameworks, plotting, and performance.\n\n## Bundled Script\n\nRun a deterministic, self-contained tabular example that writes importance data, metadata, and plots:\n\n```bash\nuv run --no-project --python 3.12 --with \"shap[plots]==0.52.0\" \\\n  skills\u002Fshap\u002Fscripts\u002Ftabular_report.py --output-dir \u002Ftmp\u002Fshap-report\n```\n\nThe script does not download data or deserialize models. Read it as a template, then replace the built-in dataset and model while preserving output selection and additivity validation.\n\n## Reference Map\n\n| File | Load when |\n|---|---|\n| [references\u002Fexplainers.md](references\u002Fexplainers.md) | Selecting or configuring explainers |\n| [references\u002Fdata-maskers.md](references\u002Fdata-maskers.md) | Choosing background data, masking semantics, or feature groups |\n| [references\u002Fplots.md](references\u002Fplots.md) | Selecting, composing, or saving visualizations |\n| [references\u002Fworkflows.md](references\u002Fworkflows.md) | Running audits, comparisons, cohorts, monitoring, or production workflows |\n| [references\u002Fmodalities.md](references\u002Fmodalities.md) | Explaining text, images, or deep models |\n| [references\u002Fmigration.md](references\u002Fmigration.md) | Updating legacy SHAP code or supporting older Python |\n| [references\u002Ftheory.md](references\u002Ftheory.md) | Explaining estimands, guarantees, dependence, interactions, and limitations |\n| [references\u002Ftroubleshooting.md](references\u002Ftroubleshooting.md) | Diagnosing runtime, shape, additivity, and compatibility problems |\n\n## Primary Sources\n\n- Documentation: https:\u002F\u002Fshap.readthedocs.io\u002Fen\u002Flatest\u002F\n- API reference: https:\u002F\u002Fshap.readthedocs.io\u002Fen\u002Flatest\u002Fapi.html\n- Release notes: https:\u002F\u002Fshap.readthedocs.io\u002Fen\u002Flatest\u002Frelease_notes.html\n- Repository: https:\u002F\u002Fgithub.com\u002Fshap\u002Fshap\n\n## Related skills\n\n- `alphagenome`: Look up precomputed AlphaGenome Atlas effects for any GRCh38 single-nucleotide variant (AVI score with Phred and 18 SHAP feature attributio…\n","# SHAP\n\nUse SHAP to describe how a fitted predictive model maps inputs to outputs. Work from the modern `shap.Explanation` API, make the explained output and background distribution explicit, and validate every explanation before interpreting it.\n\nThis skill is aligned with **SHAP 0.52.0** (released 2026-05-28). That release requires Python 3.12 or newer.\n\n## Operating Rules\n\n1. Explain a fixed, evaluated model; do not use SHAP as a substitute for predictive validation.\n2. Use held-out or clearly labeled analysis rows for explanations. Choose background rows only from an appropriate training or reference population.\n3. State the explained output: regression value, raw margin, probability, log loss, logit, or another model method.\n4. Keep explanations as `shap.Explanation` objects. Call `explainer(X)`; use `.shap_values(X)` only when maintaining legacy code.\n5. For multi-output models, select one output before using tabular plots: `explanation[..., output_index]`.\n6. Check `base_values + values.sum(...)` against the exact model output being explained.\n7. Treat SHAP as a description of model behavior under a masking\u002Fbackground choice. It does not establish causality, fairness, recourse, or scientific mechanism.\n8. Never silence an additivity failure until input shape, preprocessing, model version, output space, and row ordering have been checked.\n9. Do not load untrusted pickle, joblib, model, or explainer artifacts; those formats can execute code during deserialization.\n\n## Install\n\nCreate an isolated environment and pin the documented release:\n\n```bash\nuv venv --python 3.12\nsource .venv\u002Fbin\u002Factivate\nuv pip install \"shap[plots]==0.52.0\"\n```\n\n`shap[plots]` installs the plotting dependencies. Add the fitted model's package at a version compatible with the project. For older Python compatibility, read [references\u002Fmigration.md](references\u002Fmigration.md) instead of silently installing a different SHAP release.\n\nConfirm the environment before debugging an API mismatch:\n\n```python\nimport platform\nimport shap\n\nprint(\"Python:\", platform.python_version())\nprint(\"SHAP:\", shap.__version__)\n```\n\n## Standard Workflow\n\n### 1. Define the explanation target\n\nRecord:\n\n- model and preprocessing version;\n- exact callable or model method being explained;\n- output name\u002Findex and units;\n- evaluation rows;\n- background\u002Freference population;\n- masker and explainer algorithm;\n- SHAP and model-library versions.\n\nFor classifiers, decide whether the task needs raw margins or probabilities. Defaults differ by model family; never infer units from the plot color or sign.\n\n### 2. Select an explainer and masker\n\nStart with `shap.Explainer(model, masker)` when automatic dispatch is sufficient. Instantiate a specialized explainer when its assumptions or output controls matter.\n\n| Situation | Preferred choice | Important constraint |\n|---|---|---|\n| Supported tree ensemble | `TreeExplainer` | `model_output=\"probability\"` and `\"log_loss\"` require interventional masking and background data |\n| Linear model | `LinearExplainer` | The masker determines interventional versus correlation-aware behavior |\n| Small feature space | `ExactExplainer` | Cost grows quickly with unconstrained feature count |\n| General tabular callable | `PermutationExplainer` | Budget at least one full forward\u002Freverse permutation |\n| Hierarchical feature groups, text, or image | `PartitionExplainer` | The partition tree changes the cooperative game |\n| Differentiable neural network | `DeepExplainer` or `GradientExplainer` | Framework support, output shape, and background choice require testing |\n| Legacy Kernel SHAP workflow | `KernelExplainer` | Usually much slower than model-specific methods |\n\nUse the detailed decision guide in [references\u002Fexplainers.md](references\u002Fexplainers.md). Use [references\u002Fdata-maskers.md](references\u002Fdata-maskers.md) when features are correlated, structured, sparse, or semantically grouped.\n\n### 3. Compute a modern `Explanation`\n\nThis complete binary-classification example uses an explicit background and selects the positive-class output:\n\n```python\nimport numpy as np\nimport shap\nfrom sklearn.datasets import load_breast_cancer\nfrom sklearn.ensemble import RandomForestClassifier\nfrom sklearn.model_selection import train_test_split\n\nX, y = load_breast_cancer(as_frame=True, return_X_y=True)\nX_train, X_test, y_train, y_test = train_test_split(\n    X,\n    y,\n    test_size=0.2,\n    stratify=y,\n    random_state=7,\n)\n\nmodel = RandomForestClassifier(\n    n_estimators=200,\n    min_samples_leaf=3,\n    random_state=7,\n    n_jobs=-1,\n).fit(X_train, y_train)\n\nbackground = shap.sample(X_train, 100, random_state=7)\nexplainer = shap.Explainer(model, background, algorithm=\"tree\")\nall_outputs = explainer(X_test)\n\n# sklearn tree classifiers expose one output per class.\npositive = all_outputs[..., 1]\nassert positive.values.shape == X_test.shape\n\nreconstructed = np.asarray(positive.base_values) + positive.values.sum(axis=1)\nexpected = model.predict_proba(X_test)[:, 1]\nnp.testing.assert_allclose(reconstructed, expected, rtol=1e-5, atol=1e-6)\n\nshap.plots.beeswarm(positive, max_display=15)\nshap.plots.waterfall(positive[0], max_display=15)\n```\n\nOutput shape is model-dependent:\n\n- one tabular output: `(samples, features)`;\n- multiple tabular outputs: `(samples, features, outputs)`;\n- multiple model inputs: often a list of arrays or explanations;\n- image\u002Ftext explanations: feature axes follow the input representation, with output selection on the final axis when present.\n\nDo not use the pre-0.45 pattern `values[class_index]` for a modern multi-output array. Use `values[..., class_index]` or slice the `Explanation` itself.\n\n### 4. Control tree output semantics when needed\n\nFor a supported tree classifier, probability-space explanations must be explicit:\n\n```python\nbackground = shap.sample(X_train, 200, random_state=7)\n\nexplainer = shap.TreeExplainer(\n    model,\n    data=background,\n    feature_perturbation=\"interventional\",\n    model_output=\"probability\",\n)\nprobability_exp = explainer(X_test)\n```\n\nIn SHAP 0.52:\n\n- `feature_perturbation=\"auto\"` uses interventional semantics when background data is supplied and tree-path-dependent semantics otherwise;\n- probability and log-loss output modes are supported only with interventional semantics;\n- pass `approximate=True` to `explainer(X, approximate=True)` if deliberately using the lower-fidelity tree approximation; do not pass it to the constructor.\n\n### 5. Use a model-agnostic callable deliberately\n\nPass the exact callable whose outputs will be interpreted:\n\n```python\nmasker = shap.maskers.Independent(background, max_samples=100)\nexplainer = shap.Explainer(\n    model.predict_proba,\n    masker,\n    algorithm=\"permutation\",\n    output_names=[str(label) for label in model.classes_],\n    seed=7,\n)\n\nbudget = 2 * X_test.shape[1] + 1\nall_outputs = explainer(X_test.iloc[:20], max_evals=budget)\npositive = all_outputs[..., 1]\n```\n\nIncrease `max_evals` to average over more permutations when estimates are unstable. Keep the seed, background sample, and evaluation budget in the report.\n\n### 6. Visualize the question, not merely the available plot\n\n| Question | Plot |\n|---|---|\n| Which features have the largest average attribution magnitude? | `shap.plots.bar(exp)` |\n| How do direction, magnitude, and observed values vary globally? | `shap.plots.beeswarm(exp)` |\n| Why did one prediction differ from its baseline? | `shap.plots.waterfall(exp[i])` |\n| How does one feature's attribution vary over its values? | `shap.plots.scatter(exp[:, feature])` |\n| Do explanations form sample-level patterns? | `shap.plots.heatmap(exp)` |\n| How do predefined cohorts differ descriptively? | `shap.plots.bar(exp.cohorts(labels).abs.mean(0))` |\n| Which tokens or image regions contribute to an output? | `shap.plots.text(exp)` or `shap.plots.image(exp)` |\n\nRead [references\u002Fplots.md](references\u002Fplots.md) before customizing or saving figures.\n\n### 7. Report limitations with results\n\nAt minimum, report:\n\n- output and units;\n- baseline\u002Freference population;\n- explainer and masker;\n- sample count and selection;\n- output index\u002Fname;\n- additivity error or applicable approximation diagnostics;\n- known correlated\u002Fgrouped features;\n- whether results are local, aggregated, or cohort-specific;\n- a clear non-causal statement.\n\n## Common Tasks\n\n### Global and local analysis\n\nUse global plots to locate important patterns, scatter plots to inspect those patterns, and local plots to investigate selected rows. Do not select only visually dramatic rows without documenting the selection rule.\n\n### Multiclass models\n\nSet `output_names` where possible, inspect `explanation.output_names`, and slice an output before plotting:\n\n```python\nclass_exp = explanation[..., \"class_name\"]\n# or\nclass_exp = explanation[..., class_index]\n```\n\nNever average signed attributions across classes. For cross-class comparison, preserve the same model, rows, background, output space, and aggregation.\n\n### Cohorts, subgroup analysis, and fairness\n\nSHAP can compare how a model uses features across cohorts, but this is not a fairness test. A protected feature with small SHAP magnitude does not rule out proxy discrimination, and removing a protected feature does not establish fairness. Pair attribution analysis with performance, calibration, error-rate, and domain-appropriate fairness metrics.\n\nSee [references\u002Fworkflows.md](references\u002Fworkflows.md) for cohort construction, model comparison, error analysis, log-loss explanations, monitoring, and production records.\n\n### Text and images\n\nUse domain maskers rather than treating tokens or pixels as ordinary independent columns:\n\n- `shap.maskers.Text(tokenizer)` with `PartitionExplainer` for token groups;\n- `shap.maskers.Image(...)` with `PartitionExplainer` for image regions;\n- restrict expensive multi-output models with `outputs=...`.\n\nRead [references\u002Fmodalities.md](references\u002Fmodalities.md) for current examples and output-shape guidance.\n\n## Troubleshooting Order\n\n1. Print Python, SHAP, model-library, NumPy, and framework versions.\n2. Verify the model receives exactly the same transformed columns, order, dtype, and missing-value representation used during fitting.\n3. Print `values.shape`, `base_values.shape`, `data.shape`, `feature_names`, and `output_names`.\n4. Confirm the selected output and output units.\n5. Recompute predictions on the same rows in the same order.\n6. Test a smaller batch and representative background.\n7. Only then investigate package-specific compatibility or approximation settings.\n\nUse [references\u002Ftroubleshooting.md](references\u002Ftroubleshooting.md) for additivity failures, shape mismatches, categorical features, pipelines, deep-learning frameworks, plotting, and performance.\n\n## Bundled Script\n\nRun a deterministic, self-contained tabular example that writes importance data, metadata, and plots:\n\n```bash\nuv run --no-project --python 3.12 --with \"shap[plots]==0.52.0\" \\\n  skills\u002Fshap\u002Fscripts\u002Ftabular_report.py --output-dir \u002Ftmp\u002Fshap-report\n```\n\nThe script does not download data or deserialize models. Read it as a template, then replace the built-in dataset and model while preserving output selection and additivity validation.\n\n## Reference Map\n\n| File | Load when |\n|---|---|\n| [references\u002Fexplainers.md](references\u002Fexplainers.md) | Selecting or configuring explainers |\n| [references\u002Fdata-maskers.md](references\u002Fdata-maskers.md) | Choosing background data, masking semantics, or feature groups |\n| [references\u002Fplots.md](references\u002Fplots.md) | Selecting, composing, or saving visualizations |\n| [references\u002Fworkflows.md](references\u002Fworkflows.md) | Running audits, comparisons, cohorts, monitoring, or production workflows |\n| [references\u002Fmodalities.md](references\u002Fmodalities.md) | Explaining text, images, or deep models |\n| [references\u002Fmigration.md](references\u002Fmigration.md) | Updating legacy SHAP code or supporting older Python |\n| [references\u002Ftheory.md](references\u002Ftheory.md) | Explaining estimands, guarantees, dependence, interactions, and limitations |\n| [references\u002Ftroubleshooting.md](references\u002Ftroubleshooting.md) | Diagnosing runtime, shape, additivity, and compatibility problems |\n\n## Primary Sources\n\n- Documentation: https:\u002F\u002Fshap.readthedocs.io\u002Fen\u002Flatest\u002F\n- API reference: https:\u002F\u002Fshap.readthedocs.io\u002Fen\u002Flatest\u002Fapi.html\n- Release notes: https:\u002F\u002Fshap.readthedocs.io\u002Fen\u002Flatest\u002Frelease_notes.html\n- Repository: https:\u002F\u002Fgithub.com\u002Fshap\u002Fshap\n\n## Related skills\n\n- `alphagenome`: Look up precomputed AlphaGenome Atlas effects for any GRCh38 single-nucleotide variant (AVI score with Phred and 18 SHAP feature attributio…\n",{"name":5,"license":15,"metadata":43,"description":7,"allowed-tools":48,"compatibility":49},{"tags":44,"version":45,"category":46,"maintainer":47},"explainable AI, SHAP, feature attribution, model interpretability, machine learning","2.1","data-science-and-ml","Kalaris Labs","Read Bash","Requires Python 3.12+ and uv for SHAP 0.52.0; model-specific libraries are optional.","main","2b63f856ce19c2a797929cacabd9e0fc936812fa","plugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fshap",491,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins","https:\u002F\u002Fhol.org\u002Fplugins\u002Fbest-codex-plugins","https:\u002F\u002Fgithub.com\u002Fhashgraph-online","https:\u002F\u002Fhol.org","Open-source standards and developer tools for interoperable AI agents: discovery, identity, communication, payments, privacy and security.","2026-11-14 14:06:13",{"source":8,"skillName":5,"commands":61,"prompt":71,"zipAvailable":72},[62,65,68],{"tool":63,"command":64},"npx","npx skills add hashgraph-online\u002Fawesome-codex-plugins --skill shap",{"tool":66,"command":67},"bunx","bunx skills add hashgraph-online\u002Fawesome-codex-plugins --skill shap",{"tool":69,"command":70},"pnpm","pnpm dlx skills add hashgraph-online\u002Fawesome-codex-plugins --skill shap","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fshap\u002FSKILL.md",true,[74,80,84,88,92,96,100,104,108],{"path":75,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":78,"sourceHtmlUrl":79},"references\u002Fdata-maskers.md","REFERENCE","参考文档",10888,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fshap\u002Freferences\u002Fdata-maskers.md",{"path":81,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":82,"sourceHtmlUrl":83},"references\u002Fexplainers.md",13465,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fshap\u002Freferences\u002Fexplainers.md",{"path":85,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":86,"sourceHtmlUrl":87},"references\u002Fmigration.md",9182,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fshap\u002Freferences\u002Fmigration.md",{"path":89,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":90,"sourceHtmlUrl":91},"references\u002Fmodalities.md",10302,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fshap\u002Freferences\u002Fmodalities.md",{"path":93,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":94,"sourceHtmlUrl":95},"references\u002Fplots.md",11906,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fshap\u002Freferences\u002Fplots.md",{"path":97,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":98,"sourceHtmlUrl":99},"references\u002Ftheory.md",12545,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fshap\u002Freferences\u002Ftheory.md",{"path":101,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":102,"sourceHtmlUrl":103},"references\u002Ftroubleshooting.md",11872,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fshap\u002Freferences\u002Ftroubleshooting.md",{"path":105,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":106,"sourceHtmlUrl":107},"references\u002Fworkflows.md",17136,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fshap\u002Freferences\u002Fworkflows.md",{"path":109,"resourceType":110,"resourceTypeDesc":111,"sizeBytes":112,"sourceHtmlUrl":113},"scripts\u002Ftabular_report.py","SCRIPT","脚本",9918,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fshap\u002Fscripts\u002Ftabular_report.py",[115,124,132,140,148,156],{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":119,"sourceHtmlUrl":120,"categories":121,"keywords":122,"publishedAt":123},"01M7DV332YQMGD8WTRJ9DZQXTB","worktable-review-with-annotations","Create, inspect, reply to, update, or resolve situated Worktable annotations. Use when feedback belongs to a Doc section, block, text range, or HTML Doc, or when the user asks to address existing review feedback and coordinate a requested artifact edit.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-review-with-annotations\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-review-with-annotations\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":125,"name":126,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":128,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":123},"01M7DV2YGHCZVBEB1AHYB6CGHE","worktable-find-and-synthesize-context","Find, assess, and synthesize context from Worktable Docs and Records. Use when the user asks what a workspace contains, wants workspace-backed research, needs current facts reconciled across artifacts, or requests a cited synthesis without changing workspace state.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-find-and-synthesize-context\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-find-and-synthesize-context\u002FSKILL.md",[],[],{"skillNo":133,"name":134,"nameZh":6,"description":135,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":136,"sourceHtmlUrl":137,"categories":138,"keywords":139,"publishedAt":123},"01M7DV2TQN1H11ME2SAF9MXN7V","worktable-create-or-update-docs","Create, edit, rename, or maintain narrative Worktable Docs. Use for plans, decisions, briefs, notes, research syntheses, and other durable prose when the user requests a new artifact or a safe update to an existing one.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-update-docs\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-update-docs\u002FSKILL.md",[],[],{"skillNo":141,"name":142,"nameZh":6,"description":143,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":144,"sourceHtmlUrl":145,"categories":146,"keywords":147,"publishedAt":123},"01M7DV2NE452NEA8TXATKSNAJH","worktable-create-or-manage-records","Organize repeated structured information as durable Worktable Records. Use for research datasets, inventories, directories, pipelines, trackers, and other collections whose items need identity, fields, filtering, links, validation, or individual updates.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-records\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-records\u002FSKILL.md",[],[],{"skillNo":149,"name":150,"nameZh":6,"description":151,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":152,"sourceHtmlUrl":153,"categories":154,"keywords":155,"publishedAt":123},"01M7DV2HENRBR2KSCVM064WH0Y","worktable-create-or-manage-interactive-html","Create or improve durable visual and interactive artifacts in Worktable. Use for dashboards, trackers, calculators, mini apps, slide presentations, and other requests that benefit from a polished HTML Doc.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-interactive-html\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-interactive-html\u002FSKILL.md",[],[],{"skillNo":157,"name":158,"nameZh":6,"description":159,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":160,"sourceHtmlUrl":161,"categories":162,"keywords":163,"publishedAt":123},"01M7DV2CADR5R7RQFFYPNAGR9Y","worktable-collaborate-threads","Read, answer, and hand off messages through durable Worktable threads with users or other authenticated participants. Use when the user asks to check addressed messages, reply to a participant, continue a thread, request another agent's help, wait briefly for a response, or watch for comments and messages sent to the agent.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-collaborate-threads\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-collaborate-threads\u002FSKILL.md",[],[]]