#[non_exhaustive]pub struct MetricSpec {
pub id: String,
pub kind: MetricKind,
pub direction: MetricDirection,
}Expand description
A metric an experiment measures in both arms (spec 3.5 §7.12).
§Example
use adk_eval::experiments::{MetricDirection, MetricKind, MetricSpec};
let signups = MetricSpec::proportion("signups", MetricDirection::HigherIsBetter);
assert_eq!(signups.kind, MetricKind::Proportion);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.id: StringThe metric’s id; each Look carries samples under this id.
kind: MetricKindHow the metric is measured per unit.
direction: MetricDirectionWhich way the metric improves.
Implementations§
Source§impl MetricSpec
impl MetricSpec
Sourcepub fn new(
id: impl Into<String>,
kind: MetricKind,
direction: MetricDirection,
) -> Self
pub fn new( id: impl Into<String>, kind: MetricKind, direction: MetricDirection, ) -> Self
Creates a metric of the given kind.
Sourcepub fn proportion(id: impl Into<String>, direction: MetricDirection) -> Self
pub fn proportion(id: impl Into<String>, direction: MetricDirection) -> Self
Creates a proportion metric: the share of units with an event.
Sourcepub fn mean(id: impl Into<String>, direction: MetricDirection) -> Self
pub fn mean(id: impl Into<String>, direction: MetricDirection) -> Self
Creates a mean metric: the average of a per-unit value.
Trait Implementations§
Source§impl Clone for MetricSpec
impl Clone for MetricSpec
Source§impl Debug for MetricSpec
impl Debug for MetricSpec
Source§impl<'de> Deserialize<'de> for MetricSpec
impl<'de> Deserialize<'de> for MetricSpec
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 MetricSpec
impl PartialEq for MetricSpec
Source§impl Serialize for MetricSpec
impl Serialize for MetricSpec
impl StructuralPartialEq for MetricSpec
Auto Trait Implementations§
impl Forget for MetricSpec
impl Freeze for MetricSpec
impl Move for MetricSpec
impl RefUnwindSafe for MetricSpec
impl Send for MetricSpecwhere
RawVecInner: Send,
impl Sync for MetricSpecwhere
RawVecInner: Sync,
impl Unpin for MetricSpec
impl UnsafeUnpin for MetricSpec
impl UnwindSafe for MetricSpecwhere
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