pub enum LearningQuery<'a> {
Transition {
prev: &'a str,
action: &'a str,
target: Option<&'a str>,
},
Contextual {
prev: &'a str,
action: &'a str,
target: Option<&'a str>,
},
Ngram {
prev_prev: &'a str,
prev: &'a str,
action: &'a str,
target: Option<&'a str>,
},
Confidence {
action: &'a str,
target: Option<&'a str>,
prev: Option<&'a str>,
prev_prev: Option<&'a str>,
},
}Expand description
学習データへのクエリ
target を含む全てのコンテキストを統一的に扱う。
Variants§
Transition
遷移ボーナス (prev → action @ target)
成功エピソードで頻出する遷移は正の値、失敗エピソードで頻出は負の値。
Contextual
コンテキスト条件付きボーナス
prev_action との組み合わせでの成功率補正。
Ngram
N-gram ボーナス(3-gram パターンの価値)
Confidence
Confidence スコア(コンテキスト付き学習ボーナス)
prev / prev_prev がある場合、Transition + Contextual + Ngram を統合。 ない場合は action 単体の平均値を返す。
Implementations§
Source§impl<'a> LearningQuery<'a>
impl<'a> LearningQuery<'a>
Sourcepub fn transition(
prev: &'a str,
action: &'a str,
target: Option<&'a str>,
) -> Self
pub fn transition( prev: &'a str, action: &'a str, target: Option<&'a str>, ) -> Self
Transition クエリを作成
Sourcepub fn contextual(
prev: &'a str,
action: &'a str,
target: Option<&'a str>,
) -> Self
pub fn contextual( prev: &'a str, action: &'a str, target: Option<&'a str>, ) -> Self
Contextual クエリを作成
Sourcepub fn ngram(
prev_prev: &'a str,
prev: &'a str,
action: &'a str,
target: Option<&'a str>,
) -> Self
pub fn ngram( prev_prev: &'a str, prev: &'a str, action: &'a str, target: Option<&'a str>, ) -> Self
Ngram クエリを作成
Sourcepub fn confidence(action: &'a str, target: Option<&'a str>) -> Self
pub fn confidence(action: &'a str, target: Option<&'a str>) -> Self
Confidence クエリを作成(コンテキストなし)
Trait Implementations§
Source§impl<'a> Clone for LearningQuery<'a>
impl<'a> Clone for LearningQuery<'a>
Source§fn clone(&self) -> LearningQuery<'a>
fn clone(&self) -> LearningQuery<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for LearningQuery<'a>
impl<'a> RefUnwindSafe for LearningQuery<'a>
impl<'a> Send for LearningQuery<'a>
impl<'a> Sync for LearningQuery<'a>
impl<'a> Unpin for LearningQuery<'a>
impl<'a> UnwindSafe for LearningQuery<'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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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