Skip to main content

FitSet

Struct FitSet 

Source
pub struct FitSet {
    pub rows: Vec<(Feedback, usize)>,
    pub absent: Vec<Vec<usize>>,
}
Expand description

A log projected onto one feature order and standardized — exactly what the likelihood sees. Derived at fit time from the log plus a standardizer, and never persisted: the log is the source of truth, this is a view of it.

Fields§

§rows: Vec<(Feedback, usize)>

Standardized feedback, paired with its session index, in log order.

§absent: Vec<Vec<usize>>

Coordinate indices imputed in each row, index-parallel to Self::rows. Empty rows and an empty vector both mean “nothing was imputed”, which is the common case and the one that costs nothing.

A parallel vector rather than a field on the tuple because rows is read positionally in a dozen places (tests, the session layer, the model); widening it would touch all of them to say something only the likelihood needs.

§Why the likelihood needs it

An absent coordinate is imputed at the standardizer’s mean, which standardizes to exactly 0 — the honest imputation for “this observation says nothing about that axis”. For a duel that is the end of it: both candidates carry the same absence, so the term cancels in u_a − u_b and the observation is silent about that axis, correctly.

For keep/kill and stars it does not cancel, because there is no second candidate to cancel against. u(x) is compared to a threshold, and a coordinate imputed at zero contributes exactly zero to that sum — so the model reads a patch that might be extreme on the missing axis as though it were average on it, and takes the resulting comparison at full confidence. The information is missing; the certainty should be too, and without this it is not.

Implementations§

Source§

impl FitSet

Source

pub fn build(log: &ObservationLog, names: &[String], sz: &Standardizer) -> Self

Project every observation onto names and standardize with sz.

Coordinates the observation does not have are imputed at the standardizer’s mean — which standardizes to exactly 0, i.e. “this observation says nothing about that axis”, the honest imputation for a feature that did not exist when the vote was cast. Observations from a legacy standardized log are re-used as-is (they are already z-scores); they are on a different geometry, so the session layer migrates them to raw values first where it can.

Source

pub fn as_is(log: &ObservationLog) -> Self

Take the log’s vectors as already being on the model’s scale (unit tests and synthetic users work directly in standardized space).

Source

pub fn len(&self) -> usize

Number of observations.

Source

pub fn is_empty(&self) -> bool

True when there is nothing to condition on.

Source

pub fn n_sessions(&self) -> usize

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

Trait Implementations§

Source§

impl Clone for FitSet

Source§

fn clone(&self) -> FitSet

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 FitSet

Source§

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

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

impl Default for FitSet

Source§

fn default() -> FitSet

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

impl PartialEq for FitSet

Source§

fn eq(&self, other: &FitSet) -> 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 StructuralPartialEq for FitSet

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,

§

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