feat(ai-services): complete AVM v2 ensemble — upload endpoint, per-district metrics, A/B routing
- Add POST /avm/v2/upload-training-data so AvmRetrainCronService can push CSV rows before triggering retraining (was called but missing) - Add per-district MAE/MAPE/RMSE/R² to _evaluate_ensemble output; district_metrics are now returned in AVMv2TrainResponse and stored separately from global metrics in the model registry - Add predict_with_ab() that applies the active model's ab_test_traffic_pct for deterministic per-property cohort assignment (v2 vs heuristic baseline) - Add POST /avm/v2/ab-config to set traffic_pct on the active registry entry - Add AVMv2ABConfigRequest schema - Expand test suite: 24 → 28 tests covering upload, A/B config, and new validation paths; all green Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -213,6 +213,15 @@ class AVMv2RollbackRequest(BaseModel):
|
||||
target_version: str = Field(..., min_length=1, description="Model version to roll back to")
|
||||
|
||||
|
||||
class AVMv2ABConfigRequest(BaseModel):
|
||||
"""Request to update the A/B test traffic percentage for the active model."""
|
||||
|
||||
traffic_pct: float = Field(
|
||||
..., ge=0, le=1,
|
||||
description="Fraction of /predict calls routed to v2 (0=disabled, 0.10=10%, 1=100%)",
|
||||
)
|
||||
|
||||
|
||||
class AVMv2FeatureImportanceResponse(BaseModel):
|
||||
"""Global feature importance across the loaded ensemble.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user