Code Monkey home page Code Monkey logo

block-hmm-simulations's Introduction

General information

Code tested on MAC OS 10.15.7, MATLAB 2020a, and Python 3.9

Instructions for running the analysis and simulation scripts

Basic setup

  1. Install MATLAB, python, anaconda and jupyter notebook if these have not been installed
  2. Clone the directory git clone https://github.com/nhat-le/switching-simulations
  3. Add the folder block-hmm-simulations to the MATLAB path
  4. Install the following Python packages: smartload: python -m pip install [package_name]
  5. Install the following fork of the ssm package: https://github.com/nhat-le/ssm (Note: modified from original package https://github.com/lindermanlab/ssm)

Running blockHMM on synthetic data

  • To generate and fit the synthetic data, run blockHMM_simulations.ipynb.

Raw data files will be saved in the file blockhmm_simulated.mat. Data for the K-selection will be saved in blockhmm_synthetic_K_validation.mat.

  • Then run the MATLAB script blockhmm_synthetic.m to generate the figures.

Instructions for data analysis code for the paper

Code for producing the figures in the paper can be run by calling the scripts figX.m in MATLAB. Data required for running the code is available here

Some jupyter notebooks are provided for data pre-processing:

  • session_average_parameters_per_animal.ipynb generates the summary parameter fits of session-averaged transition functions of animals (Fig. 1)

  • switching_world_classifier.ipynb performs the forward simulations that generate results in Fig. 5, S3, S4

  • switching_world_classifier.ipynb generates the evaluation dataset used to evaluate the classifier performance in Fig. 5f.

  • src.run_multi_hmm_fits.py is run to generate the HMM fits for each animal.

block-hmm-simulations's People

Contributors

nhat-le avatar

Stargazers

 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.