percipio icon indicating copy to clipboard operation
percipio copied to clipboard

Serialization and Deserialization needed

Open robertleeplummerjr opened this issue 3 years ago • 0 comments

Implementing this isn't as easy without a means of serialization and deserialization for longer running cached/saved states. I'd like to propose the following API implementation:

// setup
const { bandits } = require('percipio')
const { Predictor } = bandits

const rewards = ["Java", "C#"]
const armIds = [0, 1]

// initial state
const predictor = Predictor([
  bandits.createArm(armIds[0], rewards[0]),
  bandits.createArm(armIds[1], rewards[1])
])

// proposals
// serialization
const serializedPredictor = predictor.serialize()

// deserialization
const predictor2 = Predictor(serializedPredictor)

robertleeplummerjr avatar Mar 24 '21 14:03 robertleeplummerjr