deployment-explainability
Skill8 starsChanged 4 months agoMITView on GitHub
Use when turning a trained model into something usable (an app, an inference function, a demo) or adding explainability. Selects the RIGHT interpretability method per problem: Grad-CAM for CNN image classification, predicted boxes for detection, mask overlays for segmentation, embedding neighbors for face recognition, SHAP for tabular, attributions or attention for text, feature and temporal importance for time-series. Also covers preprocessing parity between training and inference, calibrated scores, out-of-distribution guardrails, and decision-support framing for high-stakes domains. Triggers on 'deploy', 'inference', 'Grad-CAM', 'SHAP', 'saliency', 'explainability', 'feature importance', 'build an app', 'gradio', 'streamlit'.
In this repository22 other files it gives its agents.
- accuracy-improvement-loopSkill
- data-rigor-and-leakageSkill
- dataset-profilingSkill
- domain-3dSkill
- domain-anomaly-detectionSkill
- domain-audio-speechSkill
- domain-computer-visionSkill
- domain-generativeSkill
- domain-graphSkill
- domain-medical-imagingSkill
- domain-multimodalSkill
- domain-nlp-llmSkill
- domain-recommenderSkill
- domain-reinforcement-learningSkill
- domain-tabularSkill
- domain-time-seriesSkill
- domain-videoSkill
- literature-reviewSkill
- ml-research-methodologySkill
- notebook-deliverySkill
- rigorous-evaluationSkill
- training-optimizationSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 35
Prefer a high-sensitivity operating point when a miss is far costlier than a false alarm.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Deployment and Explainability
Preprocessing PARITY (the bug that silently ruins deployments)
The raw input a user uploads MUST pass through exactly the same pipeline as training (resize, crop, enhancement like CLAHE, normalization). Package it as one shared function reused by both training and inference. A mismatch produces confident but wrong predictions.
Pick the explainability method that fits the model and task
Grad-CAM is only for convolutional image classifiers. It is not meaningful for detection, embeddings, tabular, or text. Choose by problem:
| Model or task | Explainability | Notes |
| CNN image classification | Grad-CAM, Grad-CAM++, Score-CAM | heatmap over the regions that drove the predicted class. Good for medical scans and single-object classification. |
| Vision Transformer classification | attention rollout, attention maps | more natural than Grad-CAM for pure ViTs. |
| Object detection (faces, vehicles, objects) | draw predicted boxes with class and confidence; optional D-RISE saliency | Grad-CAM is not standard for detectors. The boxes are the explanation. |
| Segmentation | overlay the predicted mask on the image, plus per-class confidence | |
| Face recognition or verification | nearest-neighbor example faces, embedding similarity score, t-SNE or UMAP of embeddings | Grad-CAM is not meaningful for metric-learning embeddings. |
| Tabular | SHAP (global summary and per-prediction), permutation importance | the standard for stakeholder trust. |
| Text or NLP | Integrated Gradients, token attributions, attention, SHAP for text | highlight the tokens that drove the decision. |
| LLM or RAG output | show the retrieved sources and the rationale; token logprobs for confidence | grounding is the explanation. |
| Time-series | feature and lag importance, temporal attention, SHAP on features | which past steps drove the forecast. |
Caption any saliency honestly: it shows where the model looked, not a ground-truth region.
Present the result well
- Show the calibrated probability or score and the operating threshold, not just a label.
- For an ensemble, serve the single best model for a coherent prediction and explanation; show the ensemble score as a second opinion.
Guardrails (especially high-stakes)
- Out-of-distribution check: flag inputs that do not look like the training domain (wrong modality, low confidence) instead of guessing.
- Framing: for medical or safety uses, state clearly that it is a decision-support or second-reader tool, not autonomous diagnosis. A research prototype needs validation and regulatory clearance before real use.
- Prefer a high-sensitivity operating point when a miss is far costlier than a false alarm.
- Log inputs and outputs for audit; never let the model auto-decide irreversible actions.
Packaging
- Export the chosen model plus the shared preprocessing and an inference function
predict(raw)that returns the label, the score, and the explanation appropriate to the task. - A small Gradio or Streamlit app is the fastest trustworthy demo: drag-drop an input, then show the prediction, the score, the explanation, and the disclaimer. It runs on Colab, Hugging Face Spaces, or locally.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

