#[non_exhaustive]pub struct GuardrailSpec {
pub metric: MetricSpec,
pub tolerance: Tolerance,
}Expand description
A guardrail: a metric the variant must not make worse beyond a tolerance (spec 3.5 §7.12, A-I15).
§Example
use adk_eval::experiments::{GuardrailSpec, MetricDirection, MetricSpec, Tolerance};
// Unsubscribes may rise by at most 10% relative to the control.
let guardrail = GuardrailSpec::new(
MetricSpec::proportion("unsubscribes", MetricDirection::LowerIsBetter),
Tolerance::Relative(0.1),
);
assert_eq!(guardrail.metric.id, "unsubscribes");Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.metric: MetricSpecThe guarded metric.
tolerance: ToleranceHow much worse than the control the variant may be.
Implementations§
Source§impl GuardrailSpec
impl GuardrailSpec
Sourcepub fn new(metric: MetricSpec, tolerance: Tolerance) -> Self
pub fn new(metric: MetricSpec, tolerance: Tolerance) -> Self
Creates a guardrail on metric with tolerance.
Trait Implementations§
Source§impl Clone for GuardrailSpec
impl Clone for GuardrailSpec
Source§impl Debug for GuardrailSpec
impl Debug for GuardrailSpec
Source§impl<'de> Deserialize<'de> for GuardrailSpec
impl<'de> Deserialize<'de> for GuardrailSpec
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
Source§impl PartialEq for GuardrailSpec
impl PartialEq for GuardrailSpec
Source§impl Serialize for GuardrailSpec
impl Serialize for GuardrailSpec
impl StructuralPartialEq for GuardrailSpec
Auto Trait Implementations§
impl Forget for GuardrailSpec
impl Freeze for GuardrailSpec
impl Move for GuardrailSpec
impl RefUnwindSafe for GuardrailSpec
impl Send for GuardrailSpecwhere
RawVecInner: Send,
impl Sync for GuardrailSpecwhere
RawVecInner: Sync,
impl Unpin for GuardrailSpec
impl UnsafeUnpin for GuardrailSpec
impl UnwindSafe for GuardrailSpecwhere
RawVecInner: UnwindSafe,
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