focus

package
v1.22.46 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package focus accumulates confidence by counting β consecutive successes.

If wave reports success (both thresholds cleared), Focus advances a counter. Reaching β signals local finality for the choice under consideration. This is the constructive-interference analogue in the metaphor: persistence, not amplitude, creates a stable signal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Calc

func Calc(yes, total, prev int) (float64, int)

Calc calculates confidence based on votes

Types

type Confidence

type Confidence[ID comparable] struct {
	// contains filtered or unexported fields
}

Confidence tracks confidence building for consensus

func NewConfidence

func NewConfidence[ID comparable](threshold int, alpha float64) *Confidence[ID]

func (*Confidence[ID]) State

func (c *Confidence[ID]) State(id ID) (int, bool)

func (*Confidence[ID]) Update

func (c *Confidence[ID]) Update(id ID, ratio float64)

type Tracker

type Tracker[ID comparable] struct {
	// contains filtered or unexported fields
}

Tracker tracks confidence counters for items

func NewTracker

func NewTracker[ID comparable]() *Tracker[ID]

func (*Tracker[ID]) Count

func (t *Tracker[ID]) Count(id ID) int

func (*Tracker[ID]) Incr

func (t *Tracker[ID]) Incr(id ID)

func (*Tracker[ID]) Reset

func (t *Tracker[ID]) Reset(id ID)

type WindowedConfidence

type WindowedConfidence[ID comparable] struct {
	// contains filtered or unexported fields
}

WindowedConfidence tracks confidence with time windows

func NewWindowed

func NewWindowed[ID comparable](threshold int, alpha float64, window time.Duration) *WindowedConfidence[ID]

func (*WindowedConfidence[ID]) State

func (w *WindowedConfidence[ID]) State(id ID) (int, bool)

func (*WindowedConfidence[ID]) Update

func (w *WindowedConfidence[ID]) Update(id ID, ratio float64)

Jump to

Keyboard shortcuts

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