pub struct ScoreModel {
pub action_scores: HashMap<String, f64>,
pub transition_scores: HashMap<String, f64>,
pub contextual_scores: HashMap<String, f64>,
pub ngram_scores: HashMap<String, f64>,
/* private fields */
}Expand description
行動選択スコアモデル
LearnStats から事前計算されたスコアを保持。 Transition/Contextual/N-gram スコアを事前計算し、行動選択時に高速に取得可能。
Fields§
§action_scores: HashMap<String, f64>アクション毎の統合スコア (action → score)
transition_scores: HashMap<String, f64>遷移スコア (key: “prev->action” → score)
contextual_scores: HashMap<String, f64>Contextual スコア (key: “prev->action” → score)
ngram_scores: HashMap<String, f64>N-gram スコア (key: “prev_prev->prev->action” → score)
Implementations§
Source§impl ScoreModel
impl ScoreModel
Sourcepub fn from_stats(stats: &LearnStats) -> Self
pub fn from_stats(stats: &LearnStats) -> Self
LearnStats からスコアモデルを構築
Sourcepub fn with_version(self, version: ModelVersion) -> Self
pub fn with_version(self, version: ModelVersion) -> Self
バージョンを設定
Sourcepub fn with_metadata(self, metadata: ModelMetadata) -> Self
pub fn with_metadata(self, metadata: ModelMetadata) -> Self
メタデータを設定
Sourcepub fn compute_from_stats(&mut self, stats: &LearnStats)
pub fn compute_from_stats(&mut self, stats: &LearnStats)
LearnStats からスコアを計算
Sourcepub fn compute_confidence(
&self,
action: &str,
context: &ScoreContext,
) -> Option<f64>
pub fn compute_confidence( &self, action: &str, context: &ScoreContext, ) -> Option<f64>
Confidence スコアを計算(コンテキスト付き、階層的 lookup)
Sourcepub fn confidence(
&self,
action: &str,
_target: Option<&str>,
prev: Option<&str>,
prev_prev: Option<&str>,
) -> Option<f64>
pub fn confidence( &self, action: &str, _target: Option<&str>, prev: Option<&str>, prev_prev: Option<&str>, ) -> Option<f64>
Confidence スコアを取得
Sourcepub fn transition(
&self,
prev: &str,
action: &str,
target: Option<&str>,
) -> Option<f64>
pub fn transition( &self, prev: &str, action: &str, target: Option<&str>, ) -> Option<f64>
Transition スコアを取得
Trait Implementations§
Source§impl Clone for ScoreModel
impl Clone for ScoreModel
Source§fn clone(&self) -> ScoreModel
fn clone(&self) -> ScoreModel
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 moreSource§impl Debug for ScoreModel
impl Debug for ScoreModel
Source§impl Default for ScoreModel
impl Default for ScoreModel
Source§fn default() -> ScoreModel
fn default() -> ScoreModel
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ScoreModel
impl<'de> Deserialize<'de> for ScoreModel
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Model for ScoreModel
impl Model for ScoreModel
Source§fn model_type(&self) -> ModelType
fn model_type(&self) -> ModelType
モデルの種類
Source§fn version(&self) -> &ModelVersion
fn version(&self) -> &ModelVersion
バージョン(Lineage追跡用)
Source§fn created_at(&self) -> u64
fn created_at(&self) -> u64
作成日時(Unix timestamp ms)
Source§fn metadata(&self) -> &ModelMetadata
fn metadata(&self) -> &ModelMetadata
メタデータ
Source§impl Scorable for ScoreModel
impl Scorable for ScoreModel
Source§fn score_batch(&self, queries: &[ScoreQuery]) -> Vec<Option<f64>>
fn score_batch(&self, queries: &[ScoreQuery]) -> Vec<Option<f64>>
バッチスコア取得(パフォーマンス最適化用)
Auto Trait Implementations§
impl Freeze for ScoreModel
impl RefUnwindSafe for ScoreModel
impl Send for ScoreModel
impl Sync for ScoreModel
impl Unpin for ScoreModel
impl UnwindSafe for ScoreModel
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