pub struct UtilityBreakdown { /* private fields */ }Expand description
Explainable inputs and result of one utility calculation.
§Example
use termivar_core::Probability;
use termivar_scanner::{ActionCost, BenefitScore, RiskScore, UtilityBreakdown};
let utility = UtilityBreakdown::calculate(
BenefitScore::from_percent(80)?,
Probability::from_percent(75)?,
BenefitScore::from_percent(90)?,
ActionCost::new(100)?,
RiskScore::from_percent(20)?,
);
assert_eq!(utility.score().units(), 270_000_000);Implementations§
Source§impl UtilityBreakdown
impl UtilityBreakdown
Sourcepub fn calculate(
gain: BenefitScore,
confidence: Probability,
business_value: BenefitScore,
cost: ActionCost,
risk: RiskScore,
) -> Self
pub fn calculate( gain: BenefitScore, confidence: Probability, business_value: BenefitScore, cost: ActionCost, risk: RiskScore, ) -> Self
Calculates utility with integer arithmetic and half-up rounding.
Sourcepub fn gain(&self) -> BenefitScore
pub fn gain(&self) -> BenefitScore
Returns expected information or security gain.
Sourcepub fn confidence(&self) -> Probability
pub fn confidence(&self) -> Probability
Returns the selected Bayesian hypothesis posterior.
Sourcepub fn business_value(&self) -> BenefitScore
pub fn business_value(&self) -> BenefitScore
Returns target business value.
Sourcepub fn cost(&self) -> ActionCost
pub fn cost(&self) -> ActionCost
Returns estimated execution cost.
Sourcepub fn score(&self) -> UtilityScore
pub fn score(&self) -> UtilityScore
Returns the final fixed-point utility.
Trait Implementations§
Source§impl Clone for UtilityBreakdown
impl Clone for UtilityBreakdown
Source§fn clone(&self) -> UtilityBreakdown
fn clone(&self) -> UtilityBreakdown
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for UtilityBreakdown
Source§impl Debug for UtilityBreakdown
impl Debug for UtilityBreakdown
Source§impl<'de> Deserialize<'de> for UtilityBreakdown
impl<'de> Deserialize<'de> for UtilityBreakdown
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
impl Eq for UtilityBreakdown
Source§impl PartialEq for UtilityBreakdown
impl PartialEq for UtilityBreakdown
Source§impl Serialize for UtilityBreakdown
impl Serialize for UtilityBreakdown
impl StructuralPartialEq for UtilityBreakdown
Auto Trait Implementations§
impl Freeze for UtilityBreakdown
impl RefUnwindSafe for UtilityBreakdown
impl Send for UtilityBreakdown
impl Sync for UtilityBreakdown
impl Unpin for UtilityBreakdown
impl UnsafeUnpin for UtilityBreakdown
impl UnwindSafe for UtilityBreakdown
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more