https://github.com/vmarchaud/ts-mab
Typescript implementation of a multi-armed bandit
https://github.com/vmarchaud/ts-mab
mab thompson-sampling typescript
Last synced: about 1 month ago
JSON representation
Typescript implementation of a multi-armed bandit
- Host: GitHub
- URL: https://github.com/vmarchaud/ts-mab
- Owner: vmarchaud
- Created: 2020-05-17T13:50:27.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-17T14:08:29.000Z (about 6 years ago)
- Last Synced: 2025-03-01T17:48:41.624Z (over 1 year ago)
- Topics: mab, thompson-sampling, typescript
- Language: TypeScript
- Homepage: https://en.wikipedia.org/wiki/Multi-armed_bandit
- Size: 107 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Multi Armed Bandit
Wanted to test a typescript implementation and specially easily scaling it. The service in itself is stateless and push consistency the datastore, which is redis.
I used the thompson-sampling implementation from [this repository](https://github.com/alextanhongpin/node-bandit) because i'm no math expert but other implemtation can be easily added (see `src/bandits/impls/`).
# API
The service expose a simple API that expose the MAB logic so you can built on it, here are the endpoints:
Method | HTTP request | Description
------------- | ------------- | -------------
[**create**](#create) | **PUT** /bandits/{id} |
[**get**](#get) | **GET** /bandits/{id} |
[**pick**](#pick) | **GET** /bandits/{id}/pick/{pickId}?count={count} | You can use `count` if you want to make multiple pick within the same request
[**reward**](reward) | **GET** /bandits/{id}/reward/{arm} |
[**update**](#update) | **POST** /bandits/{id} |
All URIs are relative to *http://localhost/api*