pub struct Validator<T> { /* private fields */ }Expand description
Validator - 学習結果の性能検証
データを Train/Test に分割し、Test データで性能を検証する。 Learn Pipeline の外で使用される。
§Type Parameter
T- 検証対象のデータ型(Episode, ActionRecord 等)
§Example
ⓘ
use swarm_engine_core::validation::{Validator, NoRegression};
let validator = Validator::new(0.8, Box::new(NoRegression::new()));
let result = validator.validate(&episodes, |test| {
// test データで成功率を計算
compute_success_rate(test)
});Implementations§
Source§impl<T> Validator<T>
impl<T> Validator<T>
Sourcepub fn new(split_ratio: f64, strategy: Box<dyn ValidationStrategy>) -> Self
pub fn new(split_ratio: f64, strategy: Box<dyn ValidationStrategy>) -> Self
Sourcepub fn with_80_20_split(strategy: Box<dyn ValidationStrategy>) -> Self
pub fn with_80_20_split(strategy: Box<dyn ValidationStrategy>) -> Self
8:2 分割で作成
Sourcepub fn with_70_30_split(strategy: Box<dyn ValidationStrategy>) -> Self
pub fn with_70_30_split(strategy: Box<dyn ValidationStrategy>) -> Self
7:3 分割で作成
Sourcepub fn validate<F, G>(
&self,
data: &[T],
baseline_fn: F,
evaluate_fn: G,
) -> ValidationResult
pub fn validate<F, G>( &self, data: &[T], baseline_fn: F, evaluate_fn: G, ) -> ValidationResult
Sourcepub fn validate_with_baseline<F>(
&self,
data: &[T],
baseline: f64,
evaluate_fn: F,
) -> ValidationResult
pub fn validate_with_baseline<F>( &self, data: &[T], baseline: f64, evaluate_fn: F, ) -> ValidationResult
検証を実行(ベースラインを外部から指定)
Bootstrap で既に計算済みのベースラインを使用する場合。
Sourcepub fn strategy_name(&self) -> &str
pub fn strategy_name(&self) -> &str
戦略名を取得
Sourcepub fn split_ratio(&self) -> f64
pub fn split_ratio(&self) -> f64
分割比率を取得
Auto Trait Implementations§
impl<T> Freeze for Validator<T>
impl<T> !RefUnwindSafe for Validator<T>
impl<T> Send for Validator<T>where
T: Send,
impl<T> Sync for Validator<T>where
T: Sync,
impl<T> Unpin for Validator<T>where
T: Unpin,
impl<T> !UnwindSafe for Validator<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more