scoring

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package scoring provides importance scoring and decay algorithms for memory retrieval ranking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecayScorer

type DecayScorer struct {
	// HalfLife is the duration after which importance decays to 50%.
	// Default: 7 days.
	HalfLife time.Duration

	// DecayWeight controls how much importance affects the final score.
	// Range: 0-1. Default: 0.3.
	DecayWeight float64

	// AccessBoostFactor is the boost per access. Default: 0.01.
	AccessBoostFactor float64

	// MaxAccessBoost caps the total access boost. Default: 0.2.
	MaxAccessBoost float64
}

DecayScorer combines similarity with time-based importance decay and access frequency. It balances relevance (similarity) with recency (decay) and usage (access count).

Final score = similarity * (1 - decayWeight) + decayedImportance * decayWeight + accessBoost

func NewDecayScorer

func NewDecayScorer() *DecayScorer

NewDecayScorer creates a scorer with sensible defaults.

func (*DecayScorer) Score

func (s *DecayScorer) Score(result memoryrails.SearchResult, now time.Time) float64

Score computes the final retrieval score.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL