socialfoundations / whynot

A Python sandbox for decision making in dynamics
MIT License
417 stars 45 forks source link

Update RL environments to support passing config to gym.make #21

Closed millerjohnp closed 4 years ago

millerjohnp commented 4 years ago

Environments now support passing a simulator config to gym.make, e.g.

import whynot as wn
import whynot.gym as gym

config = wn.credit.Config(epsilon=100)
env = gym.make('Credit-v0', config=config)

The Credit environment additionally support passing an initial_state at construction to define the dataset used during retraining, e.g.

import whynot as wn
import whynot.gym as gym

# Subsample data
all_features, all_labels = wn.credit.CreditData.features, wn.credit.CreditData.labels
features, labels = all_features[:100], all_labels[:100]
env = gym.make('Credit-v0', initial_state=wn.credit.State(features, labels))