lime (local interpretable model-agnostic explanations)
LIME (Local Interpretable Model-agnostic Explanations) explains individual predictions using local linear approximations. **Approach**: Create perturbed samples around the instance to explain, get model predictions on perturbations, fit interpretable model (linear) locally, use local model's features as explanation. **For text**: Remove words to create perturbations, predict on each variant, fit sparse linear model to identify important words. **Algorithm**: Sample neighborhood → weight by proximity to original → fit weighted linear model → extract top features. **Output**: List of features with positive/negative contributions to prediction. **Advantages**: Model-agnostic (works on any classifier), interpretable output, local fidelity to complex model. **Limitations**: Instability (different runs give different explanations), neighborhood definition affects results, doesn't explain global model behavior. **Comparison to SHAP**: LIME is local approximation, SHAP uses Shapley values. SHAP often more stable but more expensive. **Tools**: lime library (Python), supports text, tabular, image. **Use cases**: Debug classification errors, understand individual predictions, build user trust. Foundational explainability method.