scoring

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package scoring holds the score arithmetic the detectors and engine layers share, so every caller combines independent signals the same way.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoisyOr

func NoisyOr(weights ...float64) float64

NoisyOr combines independent signal weights as 1 - Π(1 - w). Each weight is clamped to [0, 1] and NaN counts as 0, so the result is always in [0, 1]. No weights give 0. The weights are multiplied in sorted order, so the result does not depend on the order they come in (a map's, say) down to the last bit.

Types

type MaxPerKey

type MaxPerKey[K comparable] map[K]float64

MaxPerKey keeps the highest weight seen for each key, so a signal that fires many times counts once. Its NoisyOr is the score of a set of detections: noisy-or over distinct keys, each at its highest weight.

func (MaxPerKey[K]) Add

func (m MaxPerKey[K]) Add(key K, w float64)

Add records weight w for key. NaN is ignored.

func (MaxPerKey[K]) NoisyOr

func (m MaxPerKey[K]) NoisyOr() float64

NoisyOr combines the per-key maxima.

Jump to

Keyboard shortcuts

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