Options
All
  • Public
  • Public/Protected
  • All
Menu

Implementation of the Thompson Sampling algorithm

memberof

ml

Hierarchy

Implements

Indexable

[x: string]: any

Implementation of the Thompson Sampling algorithm

Index

Constructors

constructor

  • creates a new instance of the Thompson Sampling(TS) algorithm. TS a heuristic for choosing actions that addresses the exploration-exploitation dilemma in the multi-armed bandit problem. It consists in choosing the action that maximizes the expected reward with respect to a randomly drawn belief

    see

    https://en.wikipedia.org/wiki/Thompson_sampling

    example

    const dataset = new ms.ml.ThompsonSampling({bounds:10});

    prop

    {Map} this.numbers_of_rewards_1 - map of all reward 1 selections

    prop

    {Map} this.numbers_of_rewards_0 - map of all reward 0 selections

    Parameters

    • Default value options: any = {}

    Returns ThompsonSampling

Properties

bounds

bounds: number

getBound

getBound: BoundFunction

iteration

iteration: number

last_selected

last_selected: Vector

total_reward

total_reward: number

Methods

learn

  • learn(options?: any): this
  • single step trainning method

    Parameters

    • Default value options: any = {}

    Returns this

predict

  • predict(): number
  • returns next action based off of the thompson sampling

    Returns number

    returns thompson sample

train

  • train(options: any): this
  • training method for thompson sampling calculations

    Parameters

    • options: any

    Returns this