ThompsonSampling
Extends:
Implementation of the Thompson Sampling algorithm
Constructor Summary
| Public Constructor | ||
| public |
constructor(options: Object): this creates a new instance of the Thompson Sampling(TS) algorithm. |
|
Member Summary
| Public Members | ||
| public |
|
|
| public |
|
|
| public |
|
|
Method Summary
| Public Methods | ||
| public |
learn(tsRow: Object, getBound: Function): this single step trainning method |
|
| public |
predict(): number returns next action based off of the thompson sampling |
|
| public |
train(tsRow: Object | Object[], getBound: Function): this training method for thompson sampling calculations |
|
Inherited Summary
| From class ReinforcedLearningBase | ||
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
learn() interface instance method for reinforced learning step |
|
| public |
predict() interface instance method for reinforced prediction step |
|
| public |
train() interface instance method for reinforced training step |
|
Public Constructors
public constructor(options: Object): this source
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
Override:
ReinforcedLearningBase#constructorParams:
| Name | Type | Attribute | Description |
| options | Object |
|
Return:
| this |
Example:
const dataset = new ms.ml.ThompsonSampling({bounds:10});
See:
- https://en.wikipedia.org/wiki/Thompson_sampling
Public Methods
public learn(tsRow: Object, getBound: Function): this source
single step trainning method
Override:
ReinforcedLearningBase#learnParams:
| Name | Type | Attribute | Description |
| tsRow | Object | row of bound selections |
|
| getBound | Function |
|
select value of tsRow by selection value |
Return:
| this |
public predict(): number source
returns next action based off of the thompson sampling
Override:
ReinforcedLearningBase#predictReturn:
| number | returns thompson sample |
public train(tsRow: Object | Object[], getBound: Function): this source
training method for thompson sampling calculations
Override:
ReinforcedLearningBase#trainParams:
| Name | Type | Attribute | Description |
| tsRow | Object | Object[] | row of bound selections |
|
| getBound | Function |
|
select value of tsRow by selection value |
Return:
| this |
