hotlist

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package hotlist provides utilities for summarizing frequently encountered items.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry interface {
	Item() Item
	Count() int
}

Entry represents the number of times an Item has occurred.

type HotList

type HotList interface {
	AddWeighted(x Item)
	AddNWeighted(x Item, n int)
	Reset()
	Top(k int) []Entry
}

HotList tracks the frequency of items added to it, discarding infrequent items and potentially retaining items based on relative weights.

func NewPerfect

func NewPerfect() HotList

NewPerfect returns an implementation of HotList that tracks all items added, without sampling loss.

Note that the returned HotList has unbounded memory consumption.

type Item

type Item interface {
	Weight() int
}

Item instances are tracked by a Hotlist, possible based on the associated weight.

Jump to

Keyboard shortcuts

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