Date: December 2025 Scope: Explainability & Algorithm Improvements for Soulcaster Output Documents: 4 comprehensive guides + ready-to-run code
Complete investigation of:
- Part 1: Clustering explainability best practices (Sentry, GitHub, Slack patterns)
- Part 2: Algorithm alternatives (DBSCAN, HDBSCAN, Affinity Propagation, Spectral, etc.)
- Part 3: Summary comparison matrix
- Part 4: Recommended implementation plan
- Part 5: Production code examples for top 2 recommendations
Use when: You want deep technical understanding and rationale for decisions
Practical guidance for execution:
- Quick Decision Tree: Choose algorithm based on priority
- Implementation Difficulty Assessment: 4 tiers from "turn on metrics" to "two-stage clustering"
- Effort vs. Impact Matrix: Visual comparison
- UI Mockups: Current vs. proposed
- Algorithm Selection by Feature: What features each method provides
- Production Readiness Checklist: Pre-deployment verification
- FAQ & Monitoring: Common questions and alerting strategy
Use when: You're planning the actual implementation and timeline
Complete, production-ready code:
-
Implementation 1: Add silhouette scores (30 minutes)
- clustering.py: compute_cluster_metrics()
- models.py: new fields
- dashboard components: ConfidenceBadge
- 5 concrete steps with code
-
Implementation 2: Add HDBSCAN (2-3 days)
- Full clustering_hdbscan() function
- Exemplar extraction
- Soft score tracking
- Model updates
- Dashboard ExemplarItems component
-
Implementation 3: Two-stage clustering (optional)
- Vector DB coarse + DBSCAN fine
- Auto-parameter estimation
-
Testing: Unit and integration test examples
-
Deployment: Checklist for production
Use when: You're actually writing the code
Quick reference guide:
- Document overview
- Key recommendations
- Start here guide
- Success metrics
- One-page cheat sheet
Use when: Quick lookup or onboarding new team members
Action: Implement silhouette scores + confidence badge Effort: 1-2 days Code: CLUSTERING_IMPLEMENTATION.md - Implementation 1
Benefits:
- Users see clustering quality immediately
- No algorithm change (safe)
- Easy to understand (badge: high/medium/low)
- Quick ROI
What users see:
┌─────────────────────────────────┐
│ Error in async functions │
│ ✓ High Confidence (0.78) │ ← NEW
│ 12 items from Sentry + Reddit │
│ [Why grouped?] [Explain] │ ← NEW
└─────────────────────────────────┘
Action: Switch to HDBSCAN clustering algorithm Effort: 3-5 days Code: CLUSTERING_IMPLEMENTATION.md - Implementation 2
Benefits:
- Automatic cluster count (no threshold tuning)
- Exemplar items (most representative examples)
- Soft scores (probability per item)
- Outlier detection (noise points)
- Better UI story
What users see:
┌─────────────────────────────────┐
│ Error in async functions │
│ │
│ Representative Examples: │ ← NEW
│ • "Connection timeout..." (92%) │
│ • "Async pool exhaustion..." (88%) │
│ │
│ ✓ High Confidence (0.85) │
│ 12 items | [Split] [Merge] │ ← NEW
└─────────────────────────────────┘
Action: Vector DB (coarse) + DBSCAN (fine-grained) Effort: 1-2 weeks Code: CLUSTERING_IMPLEMENTATION.md - Implementation 3
Benefits:
- Best accuracy and speed combined
- Automatic eps parameter tuning
- Outlier filtering
- Dashboard confidence trends
- ✅ Fast clustering (2-3s for 5k items)
- ✅ Handles arbitrary cluster shapes
- ✅ Integrates with vector DB
- ✅ Multiple method options (agglomerative, centroid, vector-like)
- ✅ Threshold-based (simple to understand)
- ❌ No quality indication (confidence score)
- ❌ No outlier detection (spam/noise forced into clusters)
- ❌ No exemplar ranking (which items define cluster?)
- ❌ Fixed threshold (0.72) regardless of data distribution
- ❌ Hard to explain to users why items grouped
- ❌ No audit trail showing clustering decisions
Current approach is functional but opaque. Algorithm works well, but UI/UX doesn't expose why items grouped. Users see "12 items clustered" but no confidence or reasoning.
| Question | Answer | Effort | Impact |
|---|---|---|---|
| How do I show clustering quality to users? | Silhouette score badge | 1-2 days | High |
| How do I explain why items grouped? | Audit trail + exemplars | 3-5 days | Very High |
| How do I detect bad clusters? | Silhouette < 0.3 | Included above | Medium |
| How do I handle outliers? | HDBSCAN or DBSCAN | 3-5 days | Medium |
| How do I pick best representatives? | Exemplars (HDBSCAN) | 3-5 days | High |
| Should I keep current algorithm? | Yes, upgrade agglomerative | Safe | Medium |
| Should I switch to HDBSCAN? | Yes, after silhouette works | Medium risk | Very High |
| What about performance? | HDBSCAN same speed or faster | <5s for 5k items | Non-issue |
| What about complexity? | Comparable to current | Medium | Worth it |
Are you shipping today?
├─ YES → Silhouette score only (CLUSTERING_IMPLEMENTATION.md #1)
└─ NO →
Do you want best possible explainability?
├─ YES → HDBSCAN (#2 + #1)
└─ NO → Agglomerative + dendrogram + silhouette
Do you have high volume (>5000 items/day)?
├─ YES → Plan two-stage (#3) for week 2
└─ NO → HDBSCAN is sufficient
Do you have user feedback about clustering?
├─ YES → Start with explainability (silhouette)
└─ NO → Start with HDBSCAN
- All clusters display confidence badge
- Badge colors match quality (green/yellow/red)
- Users understand score from tooltip
- API includes silhouette in responses
- Target: 2x increase in cluster detail page views
- Exemplars extracted and stored
- Soft scores tracked per item
- Exemplar items displayed in UI
- Outlier count tracked
- Manual split/merge functions work
- Target: 10% improvement in cluster accuracy
- Auto-eps parameter estimation works
- Outlier percentage tracked
- Dashboard shows confidence trends
- Users report fewer "bad clusters"
- Target: 50% reduction in bad cluster complaints
- ✅ Adding silhouette scores (new fields only)
- ✅ Adding confidence badges (UI-only)
- ✅ Adding dendrogram visualization (UI-only)
Deployment: Can deploy independently, backward compatible
⚠️ Switching from agglomerative to HDBSCAN⚠️ Changing cluster membership (might split existing clusters)⚠️ New outlier handling (noise points created)
Deployment: A/B test on subset of projects first
- Always compute both old and new algorithm for 1 week
- Compare cluster results on labeled data if available
- Monitor cluster count, silhouette score changes
- Keep rollback plan (revert to agglomerative)
-
CLUSTERING_RESEARCH.md (7,500 words)
- Complete technical research
- 5 algorithm deep-dives
- Industry best practices
- 2 full code implementations
- References to 20+ sources
-
CLUSTERING_DECISION_GUIDE.md (3,500 words)
- Decision trees and matrixes
- UI mockups
- Testing checklists
- Monitoring/alerts
- FAQ
-
CLUSTERING_IMPLEMENTATION.md (4,000 words)
- 3 complete implementations (copy-paste ready)
- Step-by-step instructions
- Test examples
- Deployment checklist
-
CLUSTERING_SUMMARY.md (This file)
- Quick reference
- One-page cheat sheet
- Risk assessment
Total: ~18,000 words of research, guidance, and production-ready code
- Read CLUSTERING_SUMMARY.md (this file) - 5 min
- Read CLUSTERING_RESEARCH.md Part 1 - 20 min
- Read CLUSTERING_RESEARCH.md Part 2 - 20 min
- Look at CLUSTERING_DECISION_GUIDE.md decision trees - 10 min
Total: 1 hour to understand everything
- Read CLUSTERING_IMPLEMENTATION.md Implementation 1 - 10 min
- Copy code snippets into your IDE
- Follow 5 steps in Implementation 1
- Test with
pytest backend/tests/ - Deploy
Total: 2-4 hours to add silhouette scores
- Read CLUSTERING_DECISION_GUIDE.md - 20 min
- Have team discuss tiers (1-4)
- Pick implementation path based on timeline
- Follow corresponding section in CLUSTERING_IMPLEMENTATION.md
- Refer to CLUSTERING_RESEARCH.md for technical details
Total: 1-2 week project with best outcomes
Q: Should we keep the current clustering algorithm? A: Yes, it works well. Just add explainability metrics on top (silhouette scores). If you have time later, upgrade to HDBSCAN.
Q: Will switching to HDBSCAN break existing clusters? A: Cluster IDs might change (new UUIDs), but semantic grouping should be similar or better. Test on sample data first.
Q: How much effort is this really? A: Silhouette scores (low effort): 1-2 days. HDBSCAN (medium effort): 3-5 days. Two-stage (high effort): 1-2 weeks.
Q: What's the risk? A: Low for silhouette scores (safe addition). Medium for HDBSCAN (algorithm change). Mitigate with A/B testing.
Q: Can we do this incrementally? A: Perfect approach. Week 1: silhouette scores. Week 2-3: HDBSCAN. Month 2: two-stage refinement.
Q: What if users don't understand silhouette scores? A: Use the simple badge (high/medium/low) + tooltip. Don't expose raw numbers to users, just confidence level.
Q: How do we know if it's working? A: Track silhouette score over time, outlier percentage, cluster count distribution. Should see improvement.
- Share this summary with team (5 min read)
- Choose implementation tier (decision tree in CLUSTERING_DECISION_GUIDE.md)
- Schedule 1-2 week sprint (if going all-in on HDBSCAN)
- Start with silhouette scores (lowest risk, quick win)
- Test on production data before deploying
- Monitor cluster quality metrics post-deployment
If you have questions about:
- Research & rationale: See CLUSTERING_RESEARCH.md
- Implementation details: See CLUSTERING_IMPLEMENTATION.md
- Planning & roadmap: See CLUSTERING_DECISION_GUIDE.md
- Quick answers: See this document (CLUSTERING_SUMMARY.md)
Happy clustering! 🚀
Created with care for Soulcaster. Start with silhouette scores this week, upgrade to HDBSCAN next week if things go smoothly.