pub struct RegressionSuite { /* private fields */ }Expand description
Compares evaluation suite results against stored per-category baselines.
Fails the check if any category’s success rate drops more than
RegressionConfig::max_regression below its baseline.
Implementations§
Source§impl RegressionSuite
impl RegressionSuite
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new regression suite with default configuration and no baselines.
Sourcepub fn with_config(config: RegressionConfig) -> Self
pub fn with_config(config: RegressionConfig) -> Self
Create with custom configuration.
Sourcepub fn with_baseline(self, baseline: CategoryBaseline) -> Self
pub fn with_baseline(self, baseline: CategoryBaseline) -> Self
Manually register a baseline for a category.
Sourcepub fn add_baseline(
&mut self,
category: impl Into<String>,
stats: &EvaluationStats,
)
pub fn add_baseline( &mut self, category: impl Into<String>, stats: &EvaluationStats, )
Register a baseline from an EvaluationStats object.
Sourcepub fn record_baselines(&mut self, suite_result: &SuiteResult)
pub fn record_baselines(&mut self, suite_result: &SuiteResult)
Record baselines for ALL categories present in suite_result.
Use this to capture the current run as the new baseline.
Sourcepub fn baselines_to_json(&self) -> Result<String>
pub fn baselines_to_json(&self) -> Result<String>
Serialize baselines to a JSON string.
Sourcepub fn has_baseline(&self, category: &str) -> bool
pub fn has_baseline(&self, category: &str) -> bool
Returns true when a baseline has been recorded for category.
Sourcepub fn get_baseline(&self, category: &str) -> Option<&CategoryBaseline>
pub fn get_baseline(&self, category: &str) -> Option<&CategoryBaseline>
Retrieve the stored baseline for category, or None if absent.
Sourcepub fn load_baselines_from_json(json: &str) -> Result<Self>
pub fn load_baselines_from_json(json: &str) -> Result<Self>
Load baselines from a JSON string (produced by Self::baselines_to_json).
Sourcepub fn check(&self, suite_result: &SuiteResult) -> RegressionResult
pub fn check(&self, suite_result: &SuiteResult) -> RegressionResult
Run the regression check against a completed SuiteResult.
For each category with a stored baseline:
- Skip if
current_n_trials < min_trials. - Fail if
baseline_rate - current_rate > max_regression.