Skip to main content

Answer

Struct Answer 

Source
pub struct Answer {
    pub choice: Option<String>,
    pub score: Option<f64>,
    pub noul: Option<f64>,
    pub probabilities: Option<IndexMap<String, f64>>,
    pub confidence: Option<f64>,
    pub gating: Option<GatingMetadata>,
}
Expand description

単一の質問に対する判定結果。

Fields§

§choice: Option<String>

Choice 型の採択候補ラベル。

§score: Option<f64>

Score 型の加重平均スコア値。

§noul: Option<f64>

Noul 型の言明真実確率値(0.0 <= P <= 1.0)。

§probabilities: Option<IndexMap<String, f64>>

各候補または各段階レベルの確率分布マップ。

§confidence: Option<f64>

分布の尖り度に基づく正規化確信度(0.0 <= C <= 1.0)。

§gating: Option<GatingMetadata>

確信度ゲーティングによるルーティングおよび監査メタデータ(任意)。

Implementations§

Source§

impl Answer

Source

pub fn choice( selected: impl Into<String>, probabilities: IndexMap<String, f64>, confidence: f64, ) -> Self

Choice 判定結果を生成する。

Source

pub fn score( value: f64, probabilities: IndexMap<String, f64>, confidence: f64, ) -> Self

Score 判定結果を生成する。

Source

pub fn noul(probability: f64) -> Self

Noul 判定結果を生成する。

Source

pub fn with_gating(self, gating: GatingMetadata) -> Self

ゲーティングメタデータを付与して自身を返却する。

Source

pub fn route(&self) -> Option<DecisionRoute>

割り当てられたルーティング種別を取得する。

Source

pub fn effective_confidence(&self) -> Option<f64>

ゲーティング処理等に向けた実効確信度(Effective Confidence)を取得する。

§概要
  • Choice / Score 型の場合は、構造体に保持されている confidence 値をそのまま返却する。
  • Noul 型の場合は、Jev 公式スキーマでは confidence フィールドが None となる規約があるため、 真実確率 $P(\text{true})$ から尖り度 $|2P - 1.0|$ を即座に算出して返却する。
§戻り値
  • 判定結果に対応する 0.0〜1.0 の確信度実数値。判定結果が存在しない場合は None。

Trait Implementations§

Source§

impl Clone for Answer

Source§

fn clone(&self) -> Answer

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ComposeSchema for Answer

Source§

fn compose(generics: Vec<RefOr<Schema>>) -> RefOr<Schema>

Source§

impl Debug for Answer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Answer

Source§

fn default() -> Answer

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Answer

Source§

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 PartialEq for Answer

Source§

fn eq(&self, other: &Answer) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Answer

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Answer

Source§

impl ToSchema for Answer

Source§

fn name() -> Cow<'static, str>

Return name of the schema. Read more
Source§

fn schemas(schemas: &mut Vec<(String, RefOr<Schema>)>)

Implement reference [utoipa::openapi::schema::Schema]s for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PartialSchema for T
where T: ComposeSchema + ?Sized,

§

fn schema() -> RefOr<Schema>

Return ref or schema of implementing type that can then be used to construct combined schemas.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.