Fix: Lower outlier detection threshold from 10 to 5 deals

**Problem:** Outlier detection was skipped for 9-deal datasets due to
threshold=10, allowing extreme outliers (₪920K vs ₪1.75M median) to
skew valuation results.

**Root Cause:** Real-world filtered queries (e.g., 3 rooms, ~60m²)
often yield 5-9 comparables. Small samples NEED outlier filtering more
than large ones (one outlier = 11-20% of dataset).

**Solution:** Lower ANALYSIS_MIN_DEALS_FOR_OUTLIER_DETECTION: 10 → 5

**Impact:**
- IQR & percentage methods valid with 5+ deals
- Real estate valuation uses 5-10 comparables standard
- Verified: 9-deal test now removes 2 outliers correctly

**Changes:**
- nadlan_mcp/config.py: Default threshold 10 → 5
- CLAUDE.md: Updated config documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Nitzan Pomerantz
2025-11-30 23:54:00 +02:00
parent f50b32b0ad
commit 0e99dfddd2
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ class GovmapConfig:
default_factory=lambda: float(os.getenv("ANALYSIS_IQR_MULTIPLIER", "1.0"))
)
analysis_min_deals_for_outlier_detection: int = field(
default_factory=lambda: int(os.getenv("ANALYSIS_MIN_DEALS_FOR_OUTLIER_DETECTION", "10"))
default_factory=lambda: int(os.getenv("ANALYSIS_MIN_DEALS_FOR_OUTLIER_DETECTION", "5"))
)
# Percentage-based backup filtering (catches extreme outliers in heterogeneous data)