A OpenAI Gym Env for continuous control
Project description
Gym-style API environment
The domain features a continuos state and action space:
Action space: self.action_space = spaces.Box( low = np.float32(-np.array([2, 2, 2])), high = np.float32(np.array([2, 2, 2])))
*the actions represent the coefficients thetas of a logistic regression that will be run on the dataset of patients
Observation space: self.observation_space = spaces.Box( low=np.array([0], high=np.array([1], dtype=np.float32)
*the states represent values for the covariates X_a, X_s
At every episode there is a new population of patients, it is represented by a cross-sectional dataset
follows a truncated normal distribution
follows a Binomial distribution ,
We are interested in observing the behaviour of
The environment produces the following iteration:
**e=0, t=0**
Sees a population of patients ![equation](https://latex.codecogs.com/svg.image?(Y,&space;X_a(0),&space;X_s(0))_{i=1}^N)
**e=0, t=1**
See the same population ![equation](https://latex.codecogs.com/svg.image?(Y,&space;X_a(1),&space;X_s(1))_{i=1}^N)
take an action ![equation](https://latex.codecogs.com/svg.image?a=%5C%7B%5Ctheta_0,%20%5Ctheta_1,%20%5Ctheta_2%5C%7D)
Computes the logit risk of each observation ![equation](https://latex.codecogs.com/svg.image?\rho_1(X_a(1),&space;X_s(1)))
**e=1, t=0**
See a new population of patients ![equation](https://latex.codecogs.com/svg.image?(Y,&space;X_a(0),&space;X_s(0))_{i=1}^N)
Computes the intervention value ![equation](https://latex.codecogs.com/svg.image?%5Cbar%7BX%7D_a%20=%20g(%5Crho_1,%20X_a))
e=1, t=1
See outcome Y
Fits a logistic regression on the patients:
Retrieves the coefficients
Computes the logit risk of each observation
Computes the mean logit risk across all observations, which is the reward given by the environment back to the agent (as a result of the 'good deed' of the action)
Then the episode ends and the environment restarts from episode 1
To install
- git clone https://github.com/claudia-viaro/gym-update.git
- cd gym-update
- !pip install gym-update
- import gym
- import gym_update
- env =gym.make('update-v0')
To change version
- change version to, e.g., 1.0.7 from setup.py file
- git clone https://github.com/claudia-viaro/gym-update.git
- cd gym-update
- python setup.py sdist bdist_wheel
- twine check dist/*
- twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for gym_update-0.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55c3c8c869028d3256ecc554ea95190c98826e0b8909bf7808410adf6b35c301 |
|
MD5 | 8594fb1ad912344d13117865c3367b86 |
|
BLAKE2b-256 | e205d66f75a41f0e77fc7cf753c9e7c873cb63991906fed8101c9cee50473a19 |