An open API service indexing awesome lists of open source software.

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

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*