-
Notifications
You must be signed in to change notification settings - Fork 0
Individual Conditional Expectation Audit AI
✅ Individual Conditional Expectation (ICE) – Detailed Explanation
Individual Conditional Expectation (ICE) is an advanced Explainable AI technique that shows how a specific feature affects the prediction for each individual instance, rather than showing only the average effect.
It was introduced by Goldstein et al. in 2015 as an improvement over Partial Dependence Plots (PDP).
| Aspect | Partial Dependence Plot (PDP) | Individual Conditional Expectation (ICE) |
|---|---|---|
| Scope | Global average effect | Individual effect for each data point |
| Shows | One average line | Many lines (one per instance) |
| Can reveal | Overall trend | Heterogeneity & interactions |
| Risk of hiding patterns | High (averaging can mask differences) | Low (shows variation between individuals) |
- For each individual data point, fix all other features at their actual values.
- Vary the feature of interest across a range (e.g., age from 18 to 60).
- Record how the model’s prediction changes for that specific instance.
- Plot one line per instance.
The result is a bundle of lines that show how different individuals respond to changes in that feature.
# =============================================
# Individual Conditional Expectation (ICE) Example
# =============================================
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestClassifier
from sklearn.inspection import PartialDependenceDisplay
# Sample Threat Scoring dataset
data = pd.DataFrame({
'age': [28, 34, 19, 45, 22, 31, 27, 40],
'in_hotspot_area': [1, 0, 1, 1, 0, 1, 1, 0],
'night_communication': [1, 0, 1, 1, 0, 1, 1, 0],
'weapon_detected': [0, 1, 0, 1, 0, 0, 1, 0]
})
target = [1, 1, 0, 1, 0, 1, 1, 0]
model = RandomForestClassifier(n_estimators=100, random_state=42)
model.fit(data, target)
# Generate ICE Plot
fig, ax = plt.subplots(figsize=(10, 6))
PartialDependenceDisplay.from_estimator(
model,
data,
features=['age'], # Feature to analyze
kind='individual', # This makes it ICE
centered=True, # Centers lines at 0 for easier comparison
ax=ax
)
plt.title("Individual Conditional Expectation (ICE) Plot - Effect of Age on Threat Score")
plt.ylabel("Predicted Threat Score")
plt.xlabel("Age")
plt.grid(True)
plt.show()- If you see many lines rising sharply between ages 18–30 → the model strongly penalizes young males.
- If lines are very spread out → high heterogeneity (different people react differently to the same feature).
- Clusters of lines → groups of individuals with similar behavior.
- Reveals heterogeneity that PDP hides through averaging.
- Shows interactions and non-linear effects per individual.
- Very useful for detecting bias patterns across subgroups.
- More actionable than global averages.
- Can become visually cluttered if there are too many instances.
- Still assumes other features are fixed (does not fully solve multicollinearity).
- Computationally more expensive than PDP.
ICE plots would be extremely powerful for analyzing systems like:
- Lavender → Showing how different demographic groups (age, location, communication patterns) affect threat scores individually.
- Threat Scoring in Arbel → Revealing which individuals are most vulnerable to automatic targeting.
- Gospel → Understanding how building characteristics affect targeting decisions for different types of structures.
This method helps expose systematic discrimination that average-based methods (PDP) might obscure.
Next : more advanced example with multiple features or compare ICE with PDP in more detail?
Part.2 bukan sekadar daftar tambahan, melainkan lapisan lilitan baru:
Diam di permukaan, tapi menekan sistem narasi lewat artefak memorial.
Setiap commit adalah jejak audit yang hidup sendiri, merayap lewat clone, fork, dan indexing.
“Audit bukan sekadar catatan.
Ia adalah lilitan etis yang menekan sistem, bahkan dalam diam.”