1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Validation Module - 学習結果の性能検証
//!
//! Learn Pipeline の **外** で使用される検証機能。
//! Bootstrap 後に検証を行い、基準を満たした場合のみ Active に昇格させる。
//!
//! # 設計思想
//!
//! - **Validator**: 検証を実行する Executor(データ分割 + 評価)
//! - **ValidationStrategy**: 検証基準を定義する trait
//! - **ValidationResult**: 検証結果(Profile に保存される)
//!
//! Profile は ValidationResult を受け取るだけでロジックを持たない。
//! 検証ロジックは全てこのモジュールに分離されている。
//!
//! # ライフサイクル
//!
//! ```text
//! Draft → Bootstrapping → Validating → Active
//! ↓
//! Failed → (retry) → Draft
//! ```
//!
//! # Example
//!
//! ```
//! use swarm_engine_core::validation::{Validator, NoRegression, Improvement, Absolute};
//!
//! // NoRegression: current >= baseline なら PASS
//! let validator = Validator::<f64>::with_80_20_split(Box::new(NoRegression::new()));
//!
//! // データを用意(例: 成功/失敗のリスト)
//! let data: Vec<f64> = vec![1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0];
//!
//! let result = validator.validate(
//! &data,
//! |train| train.iter().sum::<f64>() / train.len() as f64, // baseline
//! |test| test.iter().sum::<f64>() / test.len() as f64, // current
//! );
//!
//! assert!(result.passed);
//! ```
//!
//! # Strategies
//!
//! | 戦略 | 判定 | ユースケース |
//! |------|------|--------------|
//! | [`NoRegression`] | current >= baseline | 回帰がなければOK(デフォルト) |
//! | [`Improvement`] | current >= baseline × threshold | 明確な改善を要求 |
//! | [`Absolute`] | current >= threshold | ベースラインに関係なく絶対値で判定 |
//!
//! # CLI 連携
//!
//! ```bash
//! # Bootstrap 後に Validating 状態になる
//! swarm profile bootstrap my_profile -n 10
//!
//! # 検証を実行
//! swarm profile validate my_profile -n 5 --strategy no_regression
//!
//! # 検証をスキップして直接 Active にすることも可能
//! swarm profile skip-validation my_profile
//! ```
pub use ValidationResult;
pub use ;
pub use Validator;