pub struct RoutingExperiment {
pub name: String,
/* private fields */
}Expand description
Collects routing outcomes and evaluates model variants.
Fields§
§name: StringImplementations§
Source§impl RoutingExperiment
impl RoutingExperiment
Sourcepub fn new(name: &str, variants: Vec<ExperimentVariant>) -> Self
pub fn new(name: &str, variants: Vec<ExperimentVariant>) -> Self
Creates an experiment and normalizes its variant weights.
Sourcepub fn select_variant(&self) -> Option<&ExperimentVariant>
pub fn select_variant(&self) -> Option<&ExperimentVariant>
Selects a variant using its normalized weight.
Sourcepub fn record_outcome(&mut self, variant_name: &str, outcome: RoutingOutcome)
pub fn record_outcome(&mut self, variant_name: &str, outcome: RoutingOutcome)
Records an outcome under the selected variant name.
Sourcepub fn evaluate(&self) -> Option<ExperimentResult>
pub fn evaluate(&self) -> Option<ExperimentResult>
Returns the variant with the best success-rate and savings score.
Sourcepub fn sample_count(&self, variant_name: &str) -> usize
pub fn sample_count(&self, variant_name: &str) -> usize
Returns the number of outcomes recorded for a variant.
Sourcepub fn is_conclusive(&self, min_samples: usize) -> bool
pub fn is_conclusive(&self, min_samples: usize) -> bool
Returns whether every configured variant has enough observations.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RoutingExperiment
impl RefUnwindSafe for RoutingExperiment
impl Send for RoutingExperiment
impl Sync for RoutingExperiment
impl Unpin for RoutingExperiment
impl UnsafeUnpin for RoutingExperiment
impl UnwindSafe for RoutingExperiment
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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