Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CountMinSketch

Count-min sketch

Hierarchy

Index

Constructors

constructor

Properties

Protected Readonly client

client: Red

name

name: string

Protected Readonly options

options: Options

Methods

add

  • add(item: any, increment?: number): Promise<string>
  • Add an item to the sketch

    Parameters

    • item: any

      Item

    • Default value increment: number = 1

      Increment

    Returns Promise<string>

    The number of occurrences of item

connect

  • connect(): Promise<void>

count

  • count(item: any): Promise<number>
  • Count the number of occurrences an item may be in the sketch. Because this is a probabilistic data structure, this may not necessarily be accurate.

    Parameters

    • item: any

      Item

    Returns Promise<number>

    The number of occurrences of item

disconnect

  • disconnect(): Promise<void>

fromDimensions

  • fromDimensions(width: number, depth: number): Promise<string>
  • Initialize the sketch from specified dimensions

    Parameters

    • width: number

      The number of counter in each array

    • depth: number

      The number of counter-arrays

    Returns Promise<string>

    OK on success, error otherwise

fromProbability

  • fromProbability(errorRate: number, probability: number): Promise<string>
  • Initialize the sketch from specified probability

    Parameters

    • errorRate: number

      Error rate

    • probability: number

      The desired probability for inflated count

    Returns Promise<string>

    OK on success, error otherwise

reset

  • reset(): Promise<number>