Start fixing forecast service API 12
This commit is contained in:
@@ -352,11 +352,28 @@ class TrainingErrorUpdate(BaseModel):
|
||||
job_id: str = Field(..., description="Training job identifier")
|
||||
error: str = Field(..., description="Error message")
|
||||
timestamp: datetime = Field(default_factory=datetime.now, description="Error timestamp")
|
||||
|
||||
|
||||
|
||||
class ModelMetricsResponse(BaseModel):
|
||||
"""Response schema for model performance metrics"""
|
||||
model_id: str = Field(..., description="Unique model identifier")
|
||||
accuracy: float = Field(..., description="Model accuracy (R2 score)", ge=0.0, le=1.0)
|
||||
mape: float = Field(..., description="Mean Absolute Percentage Error")
|
||||
mae: float = Field(..., description="Mean Absolute Error")
|
||||
rmse: float = Field(..., description="Root Mean Square Error")
|
||||
r2_score: float = Field(..., description="R-squared score")
|
||||
training_samples: int = Field(..., description="Number of training samples used")
|
||||
features_used: List[str] = Field(..., description="List of features used in training")
|
||||
model_type: str = Field(..., description="Type of ML model")
|
||||
created_at: Optional[str] = Field(None, description="Model creation timestamp")
|
||||
last_used_at: Optional[str] = Field(None, description="Last time model was used")
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
# Union type for all WebSocket messages
|
||||
TrainingWebSocketMessage = Union[
|
||||
TrainingProgressUpdate,
|
||||
TrainingCompletedUpdate,
|
||||
TrainingErrorUpdate
|
||||
]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user