pub struct FitnessEstimate {
pub mean: f64,
pub variance: f64,
pub ci_lower: f64,
pub ci_upper: f64,
pub observation_count: usize,
}Expand description
Full fitness estimate with uncertainty quantification
Represents a fitness value along with its statistical uncertainty, including variance and confidence intervals. This enables informed decision-making about which candidates need more evaluation.
§Example
use fugue_evo::interactive::uncertainty::FitnessEstimate;
let estimate = FitnessEstimate::new(7.5, 0.25, 10);
println!("Fitness: {:.2} ± {:.2}", estimate.mean, estimate.std_error());
println!("95% CI: [{:.2}, {:.2}]", estimate.ci_lower, estimate.ci_upper);Fields§
§mean: f64Point estimate (mean fitness)
variance: f64Variance of the estimate
ci_lower: f64Lower bound of confidence interval (default 95%)
ci_upper: f64Upper bound of confidence interval
observation_count: usizeNumber of observations contributing to this estimate
Implementations§
Source§impl FitnessEstimate
impl FitnessEstimate
Sourcepub fn new(mean: f64, variance: f64, observation_count: usize) -> Self
pub fn new(mean: f64, variance: f64, observation_count: usize) -> Self
Create a new fitness estimate from mean and variance
Automatically computes 95% confidence intervals from the variance.
§Arguments
mean- Point estimate of fitnessvariance- Variance of the estimate (not the population variance)observation_count- Number of observations used to compute the estimate
Sourcepub fn with_confidence(
mean: f64,
variance: f64,
observation_count: usize,
z_score: f64,
) -> Self
pub fn with_confidence( mean: f64, variance: f64, observation_count: usize, z_score: f64, ) -> Self
Create estimate with custom confidence level
§Arguments
mean- Point estimatevariance- Variance of the estimateobservation_count- Number of observationsz_score- Z-score for desired confidence level (e.g., 1.96 for 95%, 2.576 for 99%)
Sourcepub fn uninformative(default_mean: f64) -> Self
pub fn uninformative(default_mean: f64) -> Self
Create an uninformative estimate (infinite variance)
Used for candidates with no evaluations.
Sourcepub fn ci_contains(&self, value: f64) -> bool
pub fn ci_contains(&self, value: f64) -> bool
Check if confidence interval contains a value
Sourcepub fn ci_overlaps(&self, other: &FitnessEstimate) -> bool
pub fn ci_overlaps(&self, other: &FitnessEstimate) -> bool
Check if this estimate overlaps with another’s confidence interval
Sourcepub fn significantly_better_than(&self, other: &FitnessEstimate) -> bool
pub fn significantly_better_than(&self, other: &FitnessEstimate) -> bool
Check if this estimate is significantly better than another
Returns true if the lower bound of this estimate’s CI is above the upper bound of the other’s CI.
Sourcepub fn is_uncertain(&self, min_observations: usize) -> bool
pub fn is_uncertain(&self, min_observations: usize) -> bool
Check if this estimate has high uncertainty (needs more data)
Returns true if variance is infinite or observation count is below threshold.
Sourcepub fn coefficient_of_variation(&self) -> Option<f64>
pub fn coefficient_of_variation(&self) -> Option<f64>
Coefficient of variation (relative uncertainty)
Returns None if mean is zero to avoid division by zero.
Sourcepub fn merge(&self, other: &FitnessEstimate) -> FitnessEstimate
pub fn merge(&self, other: &FitnessEstimate) -> FitnessEstimate
Merge two independent estimates (weighted by inverse variance)
Combines two estimates using inverse-variance weighting, which is optimal for independent normal estimates.
Trait Implementations§
Source§impl Clone for FitnessEstimate
impl Clone for FitnessEstimate
Source§fn clone(&self) -> FitnessEstimate
fn clone(&self) -> FitnessEstimate
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FitnessEstimate
impl Debug for FitnessEstimate
Source§impl Default for FitnessEstimate
impl Default for FitnessEstimate
Source§impl<'de> Deserialize<'de> for FitnessEstimate
impl<'de> Deserialize<'de> for FitnessEstimate
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>,
Source§impl PartialEq for FitnessEstimate
impl PartialEq for FitnessEstimate
Source§impl Serialize for FitnessEstimate
impl Serialize for FitnessEstimate
impl StructuralPartialEq for FitnessEstimate
Auto Trait Implementations§
impl Freeze for FitnessEstimate
impl RefUnwindSafe for FitnessEstimate
impl Send for FitnessEstimate
impl Sync for FitnessEstimate
impl Unpin for FitnessEstimate
impl UnsafeUnpin for FitnessEstimate
impl UnwindSafe for FitnessEstimate
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.