Git Product home page Git Product logo

nce_cd_cis's Introduction

NCE CD+CIS

This is the implementation of the methods described in the paper "On the Connection Between Noise Contrastive Estimation and Contrastive Divergence", accepted for publication in AISTATS 2024.

Setup

This repo uses Pipenv to manage dependencies. To install, run

pipenv install

Reproduce results

Adaptive proposal distribution toy example

To generate the plot in Figure (Left), run:

python experiments/adaptive_proposal.py

Ring model experiments (use of MH acceptance probability in CNCE)

To generate the plot in Figure 1 (Middle-Right), run:

python experiments/acceptance_probability.py

Autoregressive EBM experiments

To reproduce results in Table 1.

Training

# Power:
python experiments/aem.py --criterion CRIT --n_total_steps 1000000 
# Gas:
python experiments/aem.py --criterion CRIT --dataset_name 'gas' --dropout_probability_energy_net 0.0 --dropout_probability_made 0.0 --activation_energy_net 'tanh' --n_total_steps 600000 
# Hepmass:
python experiments/aem.py --criterion CRIT --dataset_name 'hepmass' --n_total_steps 200000
# Miniboone: 
python experiments/aem.py --criterion CRIT --dataset_name 'miniboone'  --dropout_probability_energy_net 0.5 --dropout_probability_made 0.5 --train_batch_size 128 --val_batch_size 128 --n_total_steps 300000 --val_frac 1.0
# BSDS300:
python experiments/aem.py --criterion CRIT --dataset_name 'bsds300' --hidden_dim_made 512 --train_batch_size 128  --val_batch_size 128  --n_total_steps 600000 

Replace CRIT with designated criterion ('is'/'cis'/csmc').

Evaluation

To evaluate the log. likelihood for all criteria1:

# Power:
python experiments/aem_eval_log_likelihood.py --val_frac 1.0 --n_importance_samples 5000000
# Gas:
python experiments/aem_eval_log_likelihood.py --dataset_name 'gas' --dropout_probability_energy_net 0.0 --dropout_probability_made 0.0 --activation_energy_net 'tanh' --val_frac 1.0 --n_importance_samples 5000000
# Hepmass:
python experiments/aem_eval_log_likelihood.py --dataset_name 'hepmass' --val_frac 1.0 --n_importance_samples 5000000
# Miniboone:
python experiments/aem_eval_log_likelihood.py --dataset_name 'miniboone'  --dropout_probability_energy_net 0.5 --dropout_probability_made 0.5 --train_batch_size 128 --val_batch_size 128 --val_frac 1.0 --n_importance_samples 5000000
# BSDS300:
python experiments/aem_eval_log_likelihood.py --dataset_name 'bsds300' --hidden_dim_made 512 --train_batch_size 128  --val_batch_size 128 --val_frac 1.0 --n_importance_samples 5000000

To evaluate the Wasserstein distance for all criteria:

# Power:
python experiments/aem_eval_wasserstein.py --val_frac 1.0 --n_importance_samples 10000
# Gas:
python experiments/aem_eval_wasserstein.py --dataset_name 'gas' --dropout_probability_energy_net 0.0 --dropout_probability_made 0.0 --activation_energy_net 'tanh' --val_frac 1.0 --n_importance_samples 10000
# Hepmass:
python experiments/aem_eval_wasserstein.py --dataset_name 'hepmass' --val_frac 1.0 --n_importance_samples 10000
# Miniboone:
python experiments/aem_eval_wasserstein.py --dataset_name 'miniboone'  --dropout_probability_energy_net 0.5 --dropout_probability_made 0.5 --train_batch_size 128 --val_batch_size 128 --val_frac 1.0 --n_importance_samples 2000
# BSDS300:
python experiments/aem_eval_wasserstein.py --dataset_name 'bsds300' --hidden_dim_made 512 --train_batch_size 128  --val_batch_size 128 --val_frac 1.0 --n_importance_samples 10000

Footnotes

  1. Evaluation expects that all models for the given dataset have been trained (IS, CIS, CSMC for Power, Gas, Hepmass and CIS, CSMC for Miniboone, BSDS300). โ†ฉ

nce_cd_cis's People

Contributors

jackonelli avatar aolmin 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.