Giter VIP home page Giter VIP logo

nppe's Introduction

DeepSet Hyper Posterior Estimator

This repository contains the code for Part 2 of the master thesis: ``Population-Level Density Estimation Using Normalizing Flows and Hyper Posteriors". Link will be added as soon as it is available online.

Installation

To install the environment run:

conda env create -f environment.yml

To use the wandb logger, also install wandb:

pip install wandb==0.13.5

Usage

To train the DHPE model with dropout on the Lotka-Volterra dataset run:

python main.py --bn.p_theta_alpha gaussian-means --bn.x_noise_level 0.01 --bn.train_N 50000 --bn.val_N 5000 --bn.test_N 1000 --training.model cnn --training.hidden_size 128 --training.hidden_layers_data 0 --training.hidden_layers_param 5 --training.hidden_layers_out 1 --training.lr 0.001 --training.clip_grad 0.1 --training.epochs 100 --training.nr_threads 8 --training.select_parameter_dims "[0, 1, 2, 3]" --training.batch_size 2048 --training.param_dropout 0.1 --training.milestones 50 

or use the command

python main.py --from_json example_config.json

to obtain a model quickly (though this does not perform well).

However, to reproduce the results from the paper, we recommend to use the batch_run.py script to submit multiple runs to a cluster. For example, to train the models for the experiments in the paper run:

python batch_run.py --add_seeds --add_logger --add_name --dry runfiles/experiments_runfile.md 

without --dry.

The performance metrics and example posteriors can be computed and plotted with:

python results.py --compute_posterior --single_posteriors 5 --population_posteriors 1

If there are multiple runs done, this script support selecting runs based on their arguments.

Files

This repository contains the following files:

  • batch_run.py: A script to submit multiple experiment runs to a cluster (see runfiles/experimets_runfile.md).
  • main.py: The main file to run the experiments.
  • train.py: The training procedures and ratio dataset construction.
  • posterior.py: The posterior estimator and Deepset model.
  • posterior_utils.py: Helper functions and classes to compute the posterior.
  • models.py: Ratio Estimators.
  • lotka_volterra.py: A Bayesian Network to generate Lotka-Volterra data.
  • lotka_volterra_utils.py: Helper functions to generate Lotka-Volterra data.
  • results.py: Functionality to compute aggregate performance metrics and plot example posteriors.
  • settings.py: The command line parser and a ExperimentSettings object.
  • utils.py: A logger object and various other functions.

nppe's People

Contributors

lodewijkvankeizerswaard avatar

Watchers

 avatar

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.