pub struct Provenance {
pub model: String,
pub parameters: Vec<(String, String)>,
pub seed: Option<u64>,
pub stream_scheme: Option<String>,
pub versions: Vec<(String, String)>,
pub input_hash: Option<String>,
}Expand description
Audit record carried by every crate::PredictiveDistribution, so a
result can be traced to its model and replayed from its seed.
use prospicio_prob::Provenance;
let p = Provenance::new("odp_bootstrap").param("n_sims", 10_000);
assert_eq!(p.model, "odp_bootstrap");
assert_eq!(p.parameters, [("n_sims".to_string(), "10000".to_string())]);
assert_eq!(p.versions[0].0, "prospicio-prob");Fields§
§model: StringModel that produced the result, e.g. "odp_bootstrap".
parameters: Vec<(String, String)>Model parameters in the order the model reports them.
seed: Option<u64>Seed of the simulation, if the result is simulated.
stream_scheme: Option<String>Rule mapping simulations to streams, e.g. SIM_INDEX_SCHEME.
versions: Vec<(String, String)>Crate versions involved, starting with prospicio-prob.
input_hash: Option<String>Hash of the model’s canonical input, from InputHasher.
Implementations§
Source§impl Provenance
impl Provenance
Sourcepub fn new(model: impl Into<String>) -> Self
pub fn new(model: impl Into<String>) -> Self
Provenance for model, recording this crate’s version.
Sourcepub fn param(self, name: impl Into<String>, value: impl ToString) -> Self
pub fn param(self, name: impl Into<String>, value: impl ToString) -> Self
Adds a model parameter.
Sourcepub fn version(
self,
krate: impl Into<String>,
version: impl Into<String>,
) -> Self
pub fn version( self, krate: impl Into<String>, version: impl Into<String>, ) -> Self
Records the version of another crate involved, e.g. the model’s.
Sourcepub fn seed(self, seed: u64, stream_scheme: impl Into<String>) -> Self
pub fn seed(self, seed: u64, stream_scheme: impl Into<String>) -> Self
Records the seed and the stream scheme it was used with.
Sourcepub fn input_hash(self, hash: impl Into<String>) -> Self
pub fn input_hash(self, hash: impl Into<String>) -> Self
Records the hash of the model’s canonical input, normally
InputHasher::finish.
Trait Implementations§
Source§impl Clone for Provenance
impl Clone for Provenance
Source§fn clone(&self) -> Provenance
fn clone(&self) -> Provenance
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Provenance
impl Debug for Provenance
impl Eq for Provenance
Source§impl PartialEq for Provenance
impl PartialEq for Provenance
impl StructuralPartialEq for Provenance
Auto Trait Implementations§
impl Freeze for Provenance
impl RefUnwindSafe for Provenance
impl Send for Provenance
impl Sync for Provenance
impl Unpin for Provenance
impl UnsafeUnpin for Provenance
impl UnwindSafe for Provenance
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
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> ⓘ
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