pub struct TriggerContext<'a> {
pub store: Option<&'a dyn EpisodeStore>,
pub event_count: Option<usize>,
pub last_train_at: Option<u64>,
pub last_train_count: usize,
pub metrics: Option<&'a TriggerMetrics>,
}Expand description
Trigger 判定のためのコンテキスト
§使い分け
- LearnProcess(Episode ベース):
storeを指定、event_countは None - LearningSink(イベントベース):
storeは None、event_countを指定
Fields§
§store: Option<&'a dyn EpisodeStore>Episode ストア(件数確認用、オプション)
event_count: Option<usize>直接指定のイベント/Episode 件数(EpisodeStore がない場合に使用)
last_train_at: Option<u64>最終学習時刻(Unix timestamp ms)
last_train_count: usize前回学習時の Episode 件数
metrics: Option<&'a TriggerMetrics>現在の品質メトリクス(オプション)
Implementations§
Source§impl<'a> TriggerContext<'a>
impl<'a> TriggerContext<'a>
Sourcepub fn with_store(store: &'a dyn EpisodeStore) -> Self
pub fn with_store(store: &'a dyn EpisodeStore) -> Self
EpisodeStore ベースのコンテキストを作成
Sourcepub fn with_count(count: usize) -> Self
pub fn with_count(count: usize) -> Self
イベントカウントベースのコンテキストを作成(EpisodeStore 不要)
Sourcepub fn last_train_at(self, timestamp: u64) -> Self
pub fn last_train_at(self, timestamp: u64) -> Self
最終学習時刻を設定
Sourcepub fn last_train_count(self, count: usize) -> Self
pub fn last_train_count(self, count: usize) -> Self
前回学習時の件数を設定
Sourcepub fn metrics(self, metrics: &'a TriggerMetrics) -> Self
pub fn metrics(self, metrics: &'a TriggerMetrics) -> Self
メトリクスを設定
Sourcepub fn current_count(&self) -> Result<usize, TriggerError>
pub fn current_count(&self) -> Result<usize, TriggerError>
現在の件数を取得(event_count 優先、なければ store から取得)
Auto Trait Implementations§
impl<'a> Freeze for TriggerContext<'a>
impl<'a> !RefUnwindSafe for TriggerContext<'a>
impl<'a> Send for TriggerContext<'a>
impl<'a> Sync for TriggerContext<'a>
impl<'a> Unpin for TriggerContext<'a>
impl<'a> !UnwindSafe for TriggerContext<'a>
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