GithubHelp home page GithubHelp logo

tee-lab / data-driven-mesoscale-sde Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 15.95 MB

Code for the paper: Data-driven discovery of stochastic dynamical equations of collective motion. Nabeel, A., Jadhav, V., Sire, C., Theraulaz, G., Escobedo, R., Iyer, S. K., & Guttal, V. (2023).

Home Page: https://iopscience.iop.org/article/10.1088/1478-3975/ace22d

License: MIT License

MATLAB 0.06% Jupyter Notebook 99.80% Python 0.15%
collective-behaviour mesoscale stochastic-differential-equations vicsek-model self-propelled-particles

data-driven-mesoscale-sde's Introduction

Data driven mesoscale SDE

This repository contains the code for the manuscript:

Data-driven discovery of stochastic dynamical equations of collective motion. Nabeel, A., Jadhav, V., Sire, C., Theraulaz, G., Escobedo, R., Iyer, S. K., & Guttal, V. (2023). DOI: 10.1088/1478-3975/ace22d

The code is divided into two parts:

  • The directory /spp_model contains MATLAB code to simulate the agent-based models.
  • The directory /sde_discovery contains code to discover mesoscale SDEs from the simulated trajectories.

Simulating the flocking model

Generate data of positions and velocities to calculate group polarisation for given group size and parameters.

Use Matlab code /spp_model/sim_data.m to generate all the required data to calculate group polarisation. Positions, velocities of agents are stored in .mat file named n_pw.mat.

Variables are commented within the code. To reproduce the results, it is advised to run for at least T = 3500 and the number of realisations (no_it) = 15. Interaction rates, number of interacting neighbours (k_alg) and all the parameters can be changed in sim_data.m.

To simulate stochastic pairwise interaction set k_alg = 1 in sim_data.m. Similarly set k_alg = 2 and k_alg = n for ternary and Vicsek like averaging model respectively.

After running the simulation, use the data in n_pw.mat to calculate the order parameter, i.e., group polarisation. To do so, run the Matlab code /figures/grp_pol.m. This file stores all the required data in the n_pw.csv file in the format [mx, my, m].

Simulation video

To see the collective motion of agents, run the code /spp_model/simulations.m. Make sure to load n_pw.mat. Variables are defined within the code and can be changed accordingly.

Data driven SDE discovery

The notebook /sde_discovery/sde-discovery.ipynb contains code to analyze the order-parameter time series and discover mesoscale stochastic differential equations. The code uses the CSV file generated from the MATLAB code above. An example CSV file, corresponding to the ternary local interaction model is provided.

data-driven-mesoscale-sde's People

Contributors

arshednabeel avatar vivekj19 avatar

Stargazers

 avatar

Watchers

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