Git Product home page Git Product logo

contrastive-aif's Introduction

Contrastive Active Inference

[website] [paper]

This repository is the official implementation of Contrastive Active Inference (NeurIPS 2021).

If you find the code useful, please refer to our work using:

@inproceedings{Mazzaglia2021ContrastiveAIF,
	title = {Contrastive Active Inference},
	author = {Pietro Mazzaglia and Tim Verbelen and Bart Dhoedt},
	booktitle = {Advances in Neural Information Processing Systems},
	year = {2021},
	url = {https://openreview.net/forum?id=5t5FPwzE6mq}
}

Installation

Recommended: Conda env

Create and activate a conda environment running:

conda create -n contrastive-aif python=3.8`
conda activate contrastive-aif

Dependencies

To install dependencies, run:

pip install -r requirements.txt

Note: for the experiments on the Deep Mind Control Suite, you will need a licensed copy of Mujoco and to install the dm_control package.

NOTE: new versions of dm_control automatically install Mujoco with free license. However, these haven't been tested.

Train Code

To run experiments you can use one the following:

Minigrid:

python main.py --suite minigrid_pixels --task empty --config minigrid_empty_8x8 --algo contrastive_actinf --seed 34

Reacher:

python main.py --suite dmc --task reacher_easy_13 --config dmc_small dmc_benchmark --algo contrastive_actinf --seed 34

Paper Results

Acknowledgments

We would like to thank the authors of the following repositories for their useful open source code:

Dreamer [TensorFlow implementation of Dreamer]

dreamer-pytorch [PyTorch implementation of Dreamer]

contrastive-aif's People

Contributors

mazpie avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

contrastive-aif's Issues

Should predicted observations be used for computing intrinsic value term in the likelihood AIF?

I noticed that you use preferred observations for computing the intrinsic value term in the likelihood AIF. But from what I understand the preferred observations should be used only for the extrinsic value term.

_, posterior_states = self.wm.posterior(obs_embed=self.wm.obs_encoder(preferred_obs).expand(batch_b*batch_t, self.wm.obs_encoder.embed_size), prev_action=None, prev_state=init_states, is_init=True)

image

Posterior computation

In your posterior, you use the stochastic state of the prior. But in RSSM they only use the deterministic state, and observation embedding. Since the prior's stochastic state is just a function of the deterministic state, it won't have extra information to condition upon. And using the stochastic state sample might hurt computing the posterior because of the sampling noise.

I am checking in case there is some other deeper reason to use it.

x = torch.cat([prior_state['stoch'], prior_state['deter'], obs_embed], dim=-1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.