Skip to main content

ObservationLog

Struct ObservationLog 

Source
pub struct ObservationLog {
    pub observations: Vec<Observation>,
}
Expand description

The append-only feedback log for one taste profile.

Fields§

§observations: Vec<Observation>

The observations, in arrival order.

Read row by row, and a row that will not parse is skipped rather than failing the log. That is a one-line attribute standing in for a very large failure: this Vec is nested inside Profile, which is nested inside SessionState, so a single unreadable cell anywhere in the log used to abort the whole deserialize — and the caller’s only recovery is to start a new session. Losing one vote is a rounding error; losing the bank, the lineage, the pins and every vote because of it is the exact opposite of the promise the raw-φ log was built on. Observed, not imagined: one null in one φ vector silently replaced a forty-patch, gen-39 session with an empty one.

It is deliberately not quiet about the cost — Self::load and the session layer both re-serialize what they read, so a skipped row is gone from disk on the next save. That is the right trade only because a row that cannot be parsed cannot be interpreted either; there is nothing in it to keep.

Implementations§

Source§

impl ObservationLog

Source

pub fn new() -> Self

An empty log.

Source

pub fn push(&mut self, obs: Observation)

Append an observation.

Source

pub fn len(&self) -> usize

Number of observations.

Source

pub fn is_empty(&self) -> bool

True when the log holds no observations.

Source

pub fn n_sessions(&self) -> usize

Number of distinct sessions referenced (max session index + 1).

Source

pub fn n_with(&self, provenance: Provenance) -> usize

How many observations were collected each way. A count, not a weight: nothing downstream of the likelihood reads it, and the panel shows it so “the model learned this from a heard comparison” and “…from a checkbox” are distinguishable claims on screen as well as in the log.

Source

pub fn raw_rows(&self, names: &[String]) -> Vec<Vec<f64>>

Every raw φ in the log, for fitting a standardizer. Only observations already in the current schema whose names match names contribute — mixing units into a standardizer is how you get a silently wrong model.

Source

pub fn save(&self, path: &Path) -> Result<()>

Serialize to a JSON file.

Source

pub fn load(path: &Path) -> Result<Self>

Load from a JSON file.

Trait Implementations§

Source§

impl Clone for ObservationLog

Source§

fn clone(&self) -> ObservationLog

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ObservationLog

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ObservationLog

Source§

fn default() -> ObservationLog

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ObservationLog

Source§

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 ObservationLog

Source§

fn eq(&self, other: &ObservationLog) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ObservationLog

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ObservationLog

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,