heuristic

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(resolver changeset.Resolver, buckets []Bucket, valueFunc ValueFunc, scope tally.Scope) scorer.Scorer

New creates a new heuristic Scorer with the given resolver, buckets and value function. Panics if valueFunc is nil.

Types

type Bucket

type Bucket struct {
	// Min is the inclusive lower bound of the range.
	Min int
	// Max is the inclusive upper bound of the range.
	Max int
	// Score is the probability returned when the metric falls within this bucket.
	Score float64
}

Bucket defines a range [Min, Max] mapped to a probability Score.

type ValueFunc

type ValueFunc func(context.Context, entity.BatchChanges) (int, error)

ValueFunc extracts a single numeric value from a batch of changes for bucketing.

Jump to

Keyboard shortcuts

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