DeaconDesperado/flask_mab

Configure Bandits without composition logic

DeaconDesperado opened this issue · 1 comments

A major impediment to #2 at present is the need to register bandits programmatically. Could there be a JSON DSL for this?

Important functionality that would need to be preserved:

  • Dual registration methods for reward and pull, via decorators as well as inline functions
  • Wide implementation for a bandits value: at present, python objects like functions can be returned by a pull, which is a pretty cool feature 🎳

Working on this alongside #2 since it's pretty important to stop acting on instances of the extension.

New config code looks like this:

storage_engine = getattr(storage, app.config.get('MAB_STORAGE_ENGINE','JSONBanditStorage')) 
storage_opts = app.config.get('MAB_STORAGE_OPTS',("./bandits.json",))
storage_backend = storage_engine(*storage_opts)
app.bandit_storage = storage_backend

This allows a tuple of arguments to be passed into storage instances as config, which will preserve the extensibility for future storage engines.