pub struct TemporalRecencyObjective {
pub half_life_days: f64,
}Expand description
Scores a NoteCandidate by pure temporal recency with a configurable half-life.
Formula: exp(-ln(2) / half_life_days * age_days)
At age_days = 0 → score 1.0 (brand new note).
At age_days = half_life_days → score 0.5.
Complements DecayAwareSalienceObjective: this signal rewards freshness
independently of the note’s own decay rate.
Fields§
§half_life_days: f64Number of days for the recency score to halve. Must be > 0.
Implementations§
Source§impl TemporalRecencyObjective
impl TemporalRecencyObjective
Sourcepub fn default_memory() -> Self
pub fn default_memory() -> Self
Create with the ADR-021 default temporal half-life of 30 days.
Trait Implementations§
Source§impl Objective<NoteCandidate> for TemporalRecencyObjective
impl Objective<NoteCandidate> for TemporalRecencyObjective
Source§fn score(&self, candidate: &NoteCandidate, _context: &ObjectiveContext) -> f64
fn score(&self, candidate: &NoteCandidate, _context: &ObjectiveContext) -> f64
Evaluate a single candidate.
Source§fn precision(&self, _candidate: &T, _context: &ObjectiveContext) -> f64
fn precision(&self, _candidate: &T, _context: &ObjectiveContext) -> f64
Precision (inverse variance) estimate for the score of a candidate. Read more
Source§fn passes_score(&self, score: f64, context: &ObjectiveContext) -> bool
fn passes_score(&self, score: f64, context: &ObjectiveContext) -> bool
Check if a score passes the threshold. Read more
Source§fn passes(&self, candidate: &T, context: &ObjectiveContext) -> bool
fn passes(&self, candidate: &T, context: &ObjectiveContext) -> bool
Check if a candidate passes the threshold.
Source§fn batch_score(
&self,
candidates: &[T],
context: &ObjectiveContext,
) -> Vec<(usize, f64)>
fn batch_score( &self, candidates: &[T], context: &ObjectiveContext, ) -> Vec<(usize, f64)>
Score a batch of candidates and return the passing
(index, score) pairs. Read moreSource§fn select<'a>(
&self,
candidates: &'a [T],
context: &ObjectiveContext,
) -> Vec<Selection<&'a T>>
fn select<'a>( &self, candidates: &'a [T], context: &ObjectiveContext, ) -> Vec<Selection<&'a T>>
Select candidates from a list, returning all that pass in score-descending order. Read more
Source§fn select_top<'a>(
&self,
candidates: &'a [T],
n: usize,
context: &ObjectiveContext,
) -> Vec<Selection<&'a T>>
fn select_top<'a>( &self, candidates: &'a [T], n: usize, context: &ObjectiveContext, ) -> Vec<Selection<&'a T>>
Select the top N candidates. Read more
Auto Trait Implementations§
impl Freeze for TemporalRecencyObjective
impl RefUnwindSafe for TemporalRecencyObjective
impl Send for TemporalRecencyObjective
impl Sync for TemporalRecencyObjective
impl Unpin for TemporalRecencyObjective
impl UnsafeUnpin for TemporalRecencyObjective
impl UnwindSafe for TemporalRecencyObjective
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<O, T> DeterministicObjective<T> for O
impl<O, T> DeterministicObjective<T> for O
Source§fn select_deterministic<'a>(
&self,
candidates: &'a [T],
context: &ObjectiveContext,
) -> Result<Selection<&'a T>, ObjectiveError>
fn select_deterministic<'a>( &self, candidates: &'a [T], context: &ObjectiveContext, ) -> Result<Selection<&'a T>, ObjectiveError>
Select the best candidate with deterministic tie-breaking.
Source§fn select_top_deterministic<'a>(
&self,
candidates: &'a [T],
n: usize,
context: &ObjectiveContext,
) -> Vec<Selection<&'a T>>
fn select_top_deterministic<'a>( &self, candidates: &'a [T], n: usize, context: &ObjectiveContext, ) -> Vec<Selection<&'a T>>
Select the top N candidates with deterministic ordering.