[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6QG1A5GZYHDCMA5S6XG717F":3,"skill-same:01M6QG1A5GZYHDCMA5S6XG717F":113},{"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":14,"repositoryHtmlUrl":53,"repositoryHomepageUrl":54,"ownerHtmlUrl":55,"ownerBlogUrl":56,"ownerDescription":57,"updatedAt":58,"install":59,"resources":72},"01M6QG1A5GZYHDCMA5S6XG717F","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.","Tashima-Tarsh\u002FDisha6.6","Tashima-Tarsh","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F269906498?v=4","01M6PBH98X03XERH0HFT4PFB1P","NITISH KUMAR","01M6PBH9DA0M6KM3Z12P848F0K",0,"MIT","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-shap\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","0da4485785ee599388900be50db1635489d53056",".agents\u002Fskills\u002Fkal-shap","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6","https:\u002F\u002Fdisha6.6.thenitishkr.in\u002F","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh","www.thenitishkr","thenitishkr | AI • Cyber-security • Research\r\n","2026-11-08 03:33:25",{"source":8,"skillName":5,"commands":60,"prompt":70,"zipAvailable":71},[61,64,67],{"tool":62,"command":63},"npx","npx skills add Tashima-Tarsh\u002FDisha6.6 --skill shap",{"tool":65,"command":66},"bunx","bunx skills add Tashima-Tarsh\u002FDisha6.6 --skill shap",{"tool":68,"command":69},"pnpm","pnpm dlx skills add Tashima-Tarsh\u002FDisha6.6 --skill shap","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-shap\u002FSKILL.md",true,[73,79,83,87,91,95,99,103,107],{"path":74,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":77,"sourceHtmlUrl":78},"references\u002Fdata-maskers.md","REFERENCE","参考文档",10888,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-shap\u002Freferences\u002Fdata-maskers.md",{"path":80,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":81,"sourceHtmlUrl":82},"references\u002Fexplainers.md",13465,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-shap\u002Freferences\u002Fexplainers.md",{"path":84,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":85,"sourceHtmlUrl":86},"references\u002Fmigration.md",9182,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-shap\u002Freferences\u002Fmigration.md",{"path":88,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":89,"sourceHtmlUrl":90},"references\u002Fmodalities.md",10302,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-shap\u002Freferences\u002Fmodalities.md",{"path":92,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":93,"sourceHtmlUrl":94},"references\u002Fplots.md",11906,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-shap\u002Freferences\u002Fplots.md",{"path":96,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":97,"sourceHtmlUrl":98},"references\u002Ftheory.md",12545,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-shap\u002Freferences\u002Ftheory.md",{"path":100,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":101,"sourceHtmlUrl":102},"references\u002Ftroubleshooting.md",11872,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-shap\u002Freferences\u002Ftroubleshooting.md",{"path":104,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":105,"sourceHtmlUrl":106},"references\u002Fworkflows.md",17136,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-shap\u002Freferences\u002Fworkflows.md",{"path":108,"resourceType":109,"resourceTypeDesc":110,"sizeBytes":111,"sourceHtmlUrl":112},"scripts\u002Ftabular_report.py","SCRIPT","脚本",9918,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-shap\u002Fscripts\u002Ftabular_report.py",[114,144,169,196,221,245],{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":125,"publishedAt":38},"01M6QRD07D4TGNDK6VJ4EHF8BV","youtube-full","Use when the user needs YouTube transcripts, video search, channel browsing, playlist extraction, or content monitoring. Trigger phrases: 'get the transcript for', 'search YouTube for', 'what are the latest videos on', 'list this playlist', 'monitor this channel', or any request involving a YouTube URL, video ID, or @handle. Do NOT use for downloading video or audio files, YouTube engagement data (likes, comments), or private\u002Fage-restricted videos.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fyoutube-full\u002FSKILL.md",[120],{"categoryNo":121,"categoryName":122,"taxonomyType":123,"taxonomyTypeDesc":124},"01JBSEEDCAT000000000000016","图像与多媒体","SCENARIO","使用场景",[126,127,128,129,130,131,33,132,133,134,135,136,137,138,139,140,20,141,142,143],"youtube full","youtube","full","transcript","search","monitoring","Video","Audio","list","files","do","get","age","trigger","URL","browsing","request","youtube transcripts",{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":150,"publishedAt":38},"01M6QRCJ3112VYPA97YG7KGMC2","x-twitter-growth","X\u002FTwitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X\u002FTwitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fx-twitter-growth\u002FSKILL.md",[],[151,152,153,154,130,155,156,157,158,159,160,161,162,163,164,165,166,167,168,20],"twitter","x twitter growth","growth","research","content","engineering","plan","web search","competitors","analyze","engine","write","strategy","use","platform","grow","posting","competitive",{"skillNo":170,"name":171,"nameZh":6,"description":172,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":173,"categories":174,"keywords":178,"publishedAt":38},"01M6QRBN3EHQNJY42RERP7A149","write-a-skill","Create new agent skills with proper structure, progressive disclosure, and bundled resources. Use when user wants to create, write, build, or author a new skill.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwrite-a-skill\u002FSKILL.md",[175],{"categoryNo":176,"categoryName":177,"taxonomyType":123,"taxonomyTypeDesc":124},"01JBSEEDCAT000000000000023","Skill与智能体开发",[179,162,180,181,182,183,184,185,164,186,187,50,188,189,190,191,192,193,194,195],"write a skill","github","create","https","productivity","matt pocock","direct","example","build","new skill","structure","new agent","resources","with","tree","progressive disclosure","author",{"skillNo":197,"name":198,"nameZh":6,"description":199,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":200,"categories":201,"keywords":202,"publishedAt":38},"01M6QRB6G8P33PNGAF9Y69EJ9T","wrap-up","Close out a launched Claude Managed Agent — recap every primitive the founder now owns, regenerate the single-file overview page, and suggest the next 1-2 upgrades. Use when the user says \"wrap up\", \"close this out\", \"what do I own now\", \"give me the summary\", \"recap the agent\", or when the orchestrator routes phase=wrap-up. primitives_inventory.py tables everything owned (agent, environment, session, memory, outcome, deployment); overview_page.py regenerates a self-contained .\u002Fmy-agent\u002Fagent-overview.html; upgrade_suggester.py ranks the next moves from recorded deferrals plus standing hardening steps. Companion to run-without-you; the last stop before phase=done.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwrap-up\u002FSKILL.md",[],[203,204,205,206,207,208,209,210,211,164,212,136,213,214,215,216,217,218,219,220],"wrap up","up","wrap","gemini","deployment","run","file","hardening","closeout","stop","upgrade","founder","close","companion","you","tables","directions","phase",{"skillNo":222,"name":223,"nameZh":6,"description":224,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":225,"categories":226,"keywords":228,"publishedAt":38},"01M6QRA5AYC1RBFZ39GTWGS3N8","workflow-builder","Design and write deterministic multi-agent workflow scripts (.js files in .claude\u002Fworkflows\u002F) for Claude Code's Workflow tool. Use when a user wants to build, create, author, scaffold, or run a custom Claude Code workflow, orchestrate sub-agents (fan-out, pipeline, loop, judge-panel), or automate a repeatable multi-step task across fresh-context agents.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fworkflow-builder\u002FSKILL.md",[227],{"categoryNo":176,"categoryName":177,"taxonomyType":123,"taxonomyTypeDesc":124},[229,230,231,232,233,181,208,234,235,236,237,238,162,239,135,240,241,242,243,244],"workflow","workflow builder","builder","design","workflows","code","orchestrate","pipeline","loop","multi-agent","context","across","fresh","scripts","judge","claude code workflow",{"skillNo":246,"name":247,"nameZh":6,"description":248,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":249,"categories":250,"keywords":251,"publishedAt":38},"01M6QR7QMCZESKQA0ERW1E657M","weekly-review","Use when someone wants to run a weekly review, close open loops, audit stalled projects and commitments, get their system back to trusted, restart a lapsed review habit, or says \"\u002Fcs:weekly-review\". Walks David Allen's three-phase loop — GET CLEAR, GET CURRENT, GET CREATIVE — with deterministic scripts that inventory open loops, gate the checklist with named gaps, and score commitment health 0-100.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fweekly-review\u002FSKILL.md",[],[252,253,254,255,256,257,258,259,260,237,261,262,263,264,265,266,137,267,268,220],"review","weekly review","weekly","deterministic scripts","reflect","feeds","inventory","open","team","projects","project-management","scanner","conversation","back","project","sprint","cadence"]