Giter VIP home page Giter VIP logo

dynamic-predictive-coding's Introduction

DynPredCode

Code acommpanying Dynamic Predictive Coding: A Model of Hierarchical Sequence Learning and Prediction in the Neocortex

For two-level results, stay on this branch (main). For three-level results, switch to the three_level branch.

Setup

We provide an Apptainer image predcode.sif (similar to a Docker image), which provides all the necessary dependencies to train and analyze the model. You can download the image here. You're also welcome to re-build this image by

apptainer build --bind $PWD:/mnt --fakeroot predcode.sif apptainer.def

Data

You can download the data here. The data folder should be placed in the root directory of this repository.

Training the models

You can download the experiments folder from here, which contains pretrained model weights. It also contains the parmas.json files which can be used to train the models (see below). The experiments folder should be placed in the root directory of this repository.

To train the model using the natural video dataset:

apptainer run --home $PWD --nv predcode.sif python train_ista.py --model_dir experiments/two_forest --data_dir data/forest

To train the model using the Moving MNIST dataset:

apptainer run --home $PWD --nv predcode.sif python train_ista.py --model_dir experiments/two_mnist --data_dir data/mnist

You will see that we have already provided pretrained models in the experiments directory. In either folder, we used the model at the last iteration, last.pth.tar.

Training the memory model

To train the memory model:

apptainer run --home $PWD --nv predcode.sif python train_memory.py --model_dir experiments/memory --data_dir data/memory

To train the memory model with multiple conditioning:

apptainer run --home $PWD --nv predcode.sif python train_memory.py --model_dir experiments/memory_multi --data_dir data/memory_multi

Running the analysis

All analysis scripts are saved in the analysis folder. To run any of the analysis:

cd analysis/
apptainer run --home $PWD --nv predcode.sif python [xxx_analysis.py]

Each of these analysis will save analysis metadata in analysis/results folder. For any script, add the -h flag to see all options.

Visualizing the results

Once all analysis scripts have been run, you can run through the visualization.ipynb notebook to visualize the results and there should be no errors.

The figures produced by the visualization notebook are saved in analysis/figures folder, which make up all of the figures (except for the schematics) in the paper.

dynamic-predictive-coding's People

Contributors

lpjiang97 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.