Giter Club home page Giter Club logo

gradabm's Introduction

[AAMAS 2023] Differentiable Agent-based Epidemiology

Publication

Implementation of the paper "Differentiable Agent-based Epidemiology."

Authors: Ayush Chopra*, Alexander Rodríguez*, Jayakumar Subramanian, Arnau Quera-Bofarull, Balaji Krishnamurthy, B. Aditya Prakash, Ramesh Raskar

*Equal contribution

Venue: AAMAS 2023 and preliminary version in AI4ABM Workshop @ ICML 2022 (best paper award)

Paper + appendix: http://arxiv.org/abs/2207.09714

Requirements

Use the package manager conda to install required Python dependencies. Note: We used Python 3.7.

conda env create -f enviroment.yml

Training

The following command will train and predict for all regions from epidemic week 202036 (GPU):

python -u main.py -st MA -j -d 0 1 2 3 -ew 202036 --seed 1234 -m GradABM-time-varying -di COVID

where -st is the US state (joint model for counties in the state ), -j is joint training, -d are the GPU devices to be used, -ew is the epidemic week and di is disease (either COVID or Flu). For running this in multiple weeks, see examples in Scripts/run.sh.

For CPU, you want to use:

python -u main.py -st MA -j -d cpu -ew 202036 --seed 1234 -m GradABM-time-varying -di COVID

Contact:

If you have any questions about the code, please contact Alexander Rodriguez at arodriguezc[at]gatech[dot]edu and Ayush Chopra ayushc[at]mit[dot]edu

Cite our work

If you find our work useful, please cite our work:

  • Ayush Chopra, Alexander Rodríguez, Jayakumar Subramanian, Arnau Quera-Bofarull, Balaji Krishnamurthy, B. Aditya Prakash, Ramesh Raskar. 2023. Differentiable Agent-based Epidemiology. In International Conference on Autonomous Agents and Multiagent Systems.
@inproceedings{chopra2023differentiable,
  title={Differentiable Agent-based Epidemiology},
  author={Chopra, Ayush and Rodr'\iguez, Alexander and Subramanian, Jayakumar and Quera-Bofarull, Arnau and Krishnamurthy, Balaji and Prakash, B Aditya and Raskar, Ramesh},
  booktitle={International Conference on Autonomous Agents and Multiagent Systems},
  year={2023}
}

gradabm's People

Contributors

arodriguezca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gradabm's Issues

Minor typo

The readme instructs the user to execute:
conda env create -f enviroment.yml

The actual file is environment.yml. This can cause a bit of frustration if the user copy pastas the instructions :)

SFInfector IndexError

I am trying to run the cpu version exactly as described, and encountering the following error:

---- MAIN IMPORTS SUCCESSFUL -----
============================================================
state MA week 202036
Seed used for python random, numpy and torch is 1234
devices used: [device(type='cpu')]
Run:  0
0 ('25015',)
Num Agents:  160775
exception: did not work for MA week 202036: index -9223372036854775808 is out of bounds for dimension 0 with size 5

Traceback (most recent call last):
  File "/Users/biocomplexity/scripts/python/GradABM/main.py", line 85, in run_all_weeks
    counties_predicted, predictions, learned_params = train_predict(args)
                                                     ^^^^^^^^^^^^^^^^^^^
  File "/Users/biocomplexity/scripts/python/GradABM/train_abm.py", line 519, in train_predict
    counties_predicted, predictions, learned_params = runner(params, devices, verbose)
                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/biocomplexity/scripts/python/GradABM/train_abm.py", line 381, in runner
    predictions = forward_simulator(params,param_values,abm,training_num_steps,counties,devices)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/biocomplexity/scripts/python/GradABM/train_abm.py", line 282, in forward_simulator
    _, pred_t = abm[counties[c]].step(time_step, param_t[c].to(model_device))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/biocomplexity/scripts/python/GradABM/abm_model.py", line 492, in step
    lam_t = self.net(agents_data, learnable_params['r0_value'])
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/biocomplexity/miniforge3/envs/abm/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/biocomplexity/scripts/python/GradABM/abm_model.py", line 105, in forward
    return self.propagate(edge_index, x=x, edge_attr=edge_attr, t=t,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/biocomplexity/miniforge3/envs/abm/lib/python3.11/site-packages/torch_geometric/nn/conv/message_passing.py", line 467, in propagate
    out = self.message(**msg_kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/biocomplexity/scripts/python/GradABM/abm_model.py", line 112, in message
    tmp = self.lam(x_i, x_j, edge_attr, t,
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/biocomplexity/scripts/python/GradABM/abm_model.py", line 52, in lam
    A_s_i = SFInfector[x_j[:,1].long()]
            ~~~~~~~~~~^^^^^^^^^^^^^^^^^
IndexError: index -9223372036854775808 is out of bounds for dimension 0 with size 5

Any idea what might be causing this? Thanks!

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.