pub struct ContextField { /* private fields */ }Expand description
The Context Field: computes Phi for a set of items given a task context.
Implementations§
Source§impl ContextField
impl ContextField
pub fn new() -> Self
pub fn with_weights(weights: FieldWeights) -> Self
Sourcepub fn compute_phi(&self, signals: &FieldSignals) -> f64
pub fn compute_phi(&self, signals: &FieldSignals) -> f64
Compute the unified potential Phi(i,t) for a context item.
All input signals should be normalized to [0, 1] before calling. The cost and redundancy terms are subtracted (penalty).
Sourcepub fn select_view(&self, costs: &ViewCosts, temperature: f64) -> ViewKind
pub fn select_view(&self, costs: &ViewCosts, temperature: f64) -> ViewKind
Select the best view for an item given the temperature (budget pressure).
Uses Boltzmann-weighted view selection: P(view_v | item_i, T) = exp(-C(v) / T) / Z(i, T)
At low temperature (relaxed budget), denser views are preferred. At high temperature (tight budget), sparser views are preferred.
Sourcepub fn compute_batch(
&self,
items: &[(ContextItemId, FieldSignals, ViewCosts)],
budget: TokenBudget,
) -> HashMap<ContextItemId, FieldPotential>
pub fn compute_batch( &self, items: &[(ContextItemId, FieldSignals, ViewCosts)], budget: TokenBudget, ) -> HashMap<ContextItemId, FieldPotential>
Compute potentials for a batch of items.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ContextField
impl RefUnwindSafe for ContextField
impl Send for ContextField
impl Sync for ContextField
impl Unpin for ContextField
impl UnsafeUnpin for ContextField
impl UnwindSafe for ContextField
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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