Implementation of the Upper Confidence Bound algorithm

memberof

  ml

### Hierarchy

- ReinforcedLearningBase
  - UpperConfidenceBound

### Implements

- ReinforcedLearning

## Index

### Constructors

- constructor

### Properties

- bounds
- getBound
- iteration
- last_selected
- numbers_of_selections
- sums_of_rewards
- total_reward

### Methods

- learn
- predict
- train

## Constructors

### constructor

- new UpperConfidenceBound(options?: ReinforcedOptions): UpperConfidenceBound

- Overrides ReinforcedLearningBase.constructor

  - Defined in ReinforcedLearning.ts:80

  creates a new instance of the Upper confidence bound(UCB) algorithm. UCB is based on the principle of optimism in the face of uncertainty, which is to choose your actions as if the environment (in this case bandit) is as nice as is plausibly possible

  see

    http://banditalgs.com/2016/09/18/the-upper-confidence-bound-algorithm/

  example

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

  prop

    {Map} this.numbers_of_selections - map of all bound selections

  prop

    {Map} this.sums_of_rewards - successful bound selections

  #### Parameters

  - ##### Default value options: ReinforcedOptions = {}

  #### Returns UpperConfidenceBound

## Properties

### bounds

bounds: number

Implementation of ReinforcedLearning.bounds

Overrides ReinforcedLearningBase.bounds

- Defined in ReinforcedLearning.ts:80

### getBound

getBound: BoundFunction

Implementation of ReinforcedLearning.getBound

Inherited from ReinforcedLearningBase.getBound

- Defined in ReinforcedLearning.ts:27

### iteration

iteration: number

Implementation of ReinforcedLearning.iteration

Inherited from ReinforcedLearningBase.iteration

- Defined in ReinforcedLearning.ts:30

### last_selected

last_selected: Vector

Implementation of ReinforcedLearning.last_selected

Inherited from ReinforcedLearningBase.last_selected

- Defined in ReinforcedLearning.ts:28

### numbers_of_selections

numbers_of_selections: Map<number, number>

- Defined in ReinforcedLearning.ts:78

### sums_of_rewards

sums_of_rewards: Map<number, number>

- Defined in ReinforcedLearning.ts:79

### total_reward

total_reward: number

Implementation of ReinforcedLearning.total_reward

Inherited from ReinforcedLearningBase.total_reward

- Defined in ReinforcedLearning.ts:29

## Methods

### learn

- learn(options?: any): UpperConfidenceBound

- Overrides ReinforcedLearningBase.learn

  - Defined in ReinforcedLearning.ts:133

  single step trainning method

  #### Parameters

  - ##### Default value options: any = {}

  #### Returns UpperConfidenceBound

### predict

- predict(): number

- Overrides ReinforcedLearningBase.predict

  - Defined in ReinforcedLearning.ts:106

  returns next action based off of the upper confidence bound

  #### Returns number

  returns bound selection

### train

- train(options: any): this

- Overrides ReinforcedLearningBase.train

  - Defined in ReinforcedLearning.ts:152

  training method for upper confidence bound calculations

  #### Parameters

  - ##### options: any

  #### Returns this