pub struct NoveltyComputer { /* private fields */ }Expand description
Novelty signal computer.
Computes novelty = exp(-λ × days_since_agent_init) where
days_since_agent_init = (fact.created_at - session_start) / 86400.
Direction: higher novelty = fact was created close to session start; lower novelty = fact was created late in a long session. This corrects stale-episodic interference — facts that accumulated late in long sessions and pollute recall despite weak relevance.
Facts created before session start receive days = 0.0 → novelty = 1.0.
Implementations§
Source§impl NoveltyComputer
impl NoveltyComputer
Sourcepub fn new(session_start: i64, decay_rate: f64) -> Self
pub fn new(session_start: i64, decay_rate: f64) -> Self
Create a new NoveltyComputer.
§Parameters
session_start: Unix timestamp (seconds) when the agent session began.decay_rate: λ inexp(-λ × days). Larger values penalize late-session facts more strongly.
§Examples
use zeph_memory::five_signal::novelty::NoveltyComputer;
let start = 1_700_000_000_i64;
let computer = NoveltyComputer::new(start, 0.1);
// Fact created at session start → novelty = 1.0
assert!((computer.compute(start) - 1.0).abs() < 1e-9);
// Fact created 10 days into the session → novelty ≈ exp(-1.0)
let ten_days_later = start + 10 * 86400;
let expected = (-1.0_f64).exp();
assert!((computer.compute(ten_days_later) - expected).abs() < 1e-9);Auto Trait Implementations§
impl Freeze for NoveltyComputer
impl RefUnwindSafe for NoveltyComputer
impl Send for NoveltyComputer
impl Sync for NoveltyComputer
impl Unpin for NoveltyComputer
impl UnsafeUnpin for NoveltyComputer
impl UnwindSafe for NoveltyComputer
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> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request