pub struct Decision {
pub accept: f64,
pub restrict: f64,
pub unknown: f64,
}
Expand description
A Decision
represents evidence in favor of either accepting or restricting an operation under consideration.
It is composed of three values: accept
, restrict
and unknown
. Each must be between 0.0 and 1.0 inclusive
and the sum of all three must equal 1.0. The unknown
value represents uncertainty about the evidence, with
a 1.0 unknown
value indicating total uncertainty or a “no opinion” verdict. Similarly, a 1.0 accept
or
restrict
value indicates total certainty that the verdict should be to accept or to restrict, respectively.
This representation allows for a fairly intuitive way of characterizing evidence in favor of or against
blocking an operation, while still capturing any uncertainty. Limiting to two states rather than a wider range of
classification possibilities allows for better performance optimizations, simplifies code readability, and
enables useful transformations like reweighting a Decision
.
This data structure is a two-state Dempster-Shafer
mass function, with the power set represented by the unknown
value. This enables the use of combination rules
to aggregate decisions from multiple sources. However, knowledge of Dempster-Shafer theory should not be necessary.
Fields§
§accept: f64
§restrict: f64
§unknown: f64
Implementations§
Source§impl Decision
impl Decision
Sourcepub fn pignistic(&self) -> Decision
pub fn pignistic(&self) -> Decision
Reassigns unknown mass evenly to accept and restrict.
This function is used to convert to a form that is useful in producing a final outcome.
Sourcepub fn outcome(
&self,
trust: f64,
suspicious: f64,
restrict: f64,
) -> Result<Outcome, ThresholdError>
pub fn outcome( &self, trust: f64, suspicious: f64, restrict: f64, ) -> Result<Outcome, ThresholdError>
Checks the restrict
value after pignistic
transformation against several threshold values.
The Outcome
s are arranged in ascending order: Trusted
< Accepted
< Suspected
< Restricted
Does not take an accept
threshold to simplify validation. Returns ThresholdError
if threshold values are
either out-of-order or out-of-range. Thresholds must be between 0.0 and 1.0.
§Arguments
trust
- Thetrust
threshold is an upper-bound threshold. If therestrict
value is below it, the operation isTrusted
.suspicious
- Thesuspicious
threshold is a lower-bound threshold that also defines the accepted range. If therestrict
value is above thetrust
threshold and below thesuspicious
threshold, the operation isAccepted
. If therestrict
value is above thesuspicious
threshold but below therestrict
threshold, the operation isSuspected
.restrict
- Therestricted
threshold is a lower-bound threshold. If therestrict
value is above it, the operation isRestricted
.
Sourcepub fn clamp(&self) -> Decision
pub fn clamp(&self) -> Decision
Clamps all values to the 0.0 to 1.0 range.
Does not guarantee that values will sum to 1.0.
Sourcepub fn clamp_min_unknown(&self, min: f64) -> Decision
pub fn clamp_min_unknown(&self, min: f64) -> Decision
Sourcepub fn fill_unknown(&self) -> Decision
pub fn fill_unknown(&self) -> Decision
If the component values sum to less than 1.0, assigns the remainder to the
unknown
value.
Sourcepub fn scale_min_unknown(&self, min: f64) -> Decision
pub fn scale_min_unknown(&self, min: f64) -> Decision
Sourcepub fn weight(&self, factor: f64) -> Decision
pub fn weight(&self, factor: f64) -> Decision
Multiplies the accept
and restrict
by the factor
parameter, replacing the unknown
value with the remainder.
Weights below 1.0 will reduce the weight of a Decision
, while weights above 1.0 will increase it.
A 1.0 weight has no effect on the result, aside from scaling it to a valid range if necessary.
§Arguments
Sourcepub fn combine_conjunctive<'a, I>(decisions: I) -> Decision
pub fn combine_conjunctive<'a, I>(decisions: I) -> Decision
Calculates the conjunctive combination of a set of decisions, returning a new Decision
as the result.
Unlike combine_murphy
, combine_conjunctive
will produce a NaN
result under
high conflict.
§Arguments
decisions
- TheDecision
s to be combined.
Sourcepub fn combine_murphy<'a, I>(decisions: I) -> Decision
pub fn combine_murphy<'a, I>(decisions: I) -> Decision
Calculates the Murphy average of a set of decisions, returning a new Decision
as the result.
The Murphy average rule1 takes the mean value of each focal element across all mass functions to create a new mass function. This new mass function is then combined conjunctively with itself N times where N is the total number of functions that were averaged together.
§Arguments
decisions
- TheDecision
s to be combined.
Catherine K. Murphy. 2000. Combining belief functions when evidence conflicts. Decision Support Systems 29, 1 (2000), 1-9. DOI:https://doi.org/10.1016/s0167-9236(99)00084-6 ↩