Python implementation of reverse engineering neural networks
Project description
reverse-engineering-py
Overview
This repository is a Python implementation of takuyaisomura/reverse_engineering, which provides code for research papers on reverse engineering neural networks.
Copyright
- Original code: (C) 2021 Takuya Isomura (RIKEN Center for Brain Science)
- Python implementation: (C) 2024 Araya Inc.
Papers
This repository is based on the following papers:
-
"Reverse-engineering neural networks to characterize their cost functions" Takuya Isomura, Karl Friston Neural Computation 32(11), 2085–2121 (2020). https://doi.org/10.1162/neco_a_01315
-
"Canonical neural networks perform active inference" Takuya Isomura, Hideaki Shimazaki, Karl Friston Communications Biology 5, 55 (2022). https://doi.org/10.1038/s42003-021-02994-2
-
"Experimental validation of the free-energy principle with in vitro neural networks" Takuya Isomura, Kiyoshi Kotani, Yasuhiko Jimbo, Karl Friston Nature Communications 14, 4547 (2023). https://doi.org/10.1038/s41467-023-40141-z
Example Notebooks
The following Colab notebooks provide explanations and usage examples:
|
BSS Blind Source Separation (Paper 1 & 3) |
Maze Maze Navigation (Paper 2) |
In vitro BSS In vitro Neural Network Analysis (Paper 3) |
Installation
It is recommended to use a virtual environment for installation. This project has been tested with Python 3.10.
- Create and activate a virtual environment
python -m venv venv
source venv/bin/activate # On Windows, use venv\Scripts\activate.ps1 or activate.bat
- Install:
- Option 1: Install from PyPI (core library only, without examples)
pip install reverse-engineering-py
- Option 2: Clone the repository (includes examples and full source code)
git clone https://github.com/takuyaisomura/reverse-engineering-py.git
cd reverse-engineering-py
pip install -e .
Main contents
This repository contains:
- Free energy agent class (pomdp.py)
- Functions for analyzing invitro neuronal response data (analysis.py)
- Example code to reproduce main results from each paper (example/)
reverse_engineering/
├── pomdp.py # Free energy agent class for simulation
├── analysis.py # Functions for analyzing invitro neuronal response data
└── utils/
└── variable_conversion.py # Functions to convert between NN and Bayesian variables
example/ # Example code to reproduce main results from each paper
├── bss/ # Paper 1 (and 3)
│ └── main.py # Runs blind source separation simulation and outputs figures
├── maze/ # Paper 2
│ └── main.py # Runs maze simulation and outputs figures
└── invitro_bss/ # Paper 3
├── data/ # Neuronal response data
└── main.py # Analyzes data using analysis.py and outputs figures/videos
example/bss
This example demonstrates blind source separation (BSS) by using the free-energy principle. The implementation is based on the Paper 1 and Paper 3.
python example/bss/main.py
example/maze
This example demonstrates maze navigation by using the free-energy principle. The implementation is based on the Paper 2.
python example/maze/main.py
example/invitro_bss
This example analyzes data from invitro neuronal networks performing blind source separation (BSS) using the reverse engineering approach. The implementation is based on the Paper 3.
python example/invitro_bss/main.py
License
This project is covered under the GNU General Public License v3.0.
Feedback and Contributing
All feedback including questions, bug reports, and feature improvement suggestions are welcome through GitHub Issues. Pull requests are also appreciated.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reverse_engineering_py-0.1.1.tar.gz.
File metadata
- Download URL: reverse_engineering_py-0.1.1.tar.gz
- Upload date:
- Size: 50.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acd3f14958aac034aa60ba4fb783914352156829bdc7c0691a0b37a9d382be55
|
|
| MD5 |
9c06cfeacbe2f6cfbaa2a926b4eb2df4
|
|
| BLAKE2b-256 |
8517fdfb399fc88e432d751be2290a54ad587d238855a476e5d5cdf93c55f4e9
|
File details
Details for the file reverse_engineering_py-0.1.1-py3-none-any.whl.
File metadata
- Download URL: reverse_engineering_py-0.1.1-py3-none-any.whl
- Upload date:
- Size: 36.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af5f4a6f6ffad5791ecd9c40f65d6aa24ffbb13fdda7d83738da628b15b16bbf
|
|
| MD5 |
4c5b27ee2d8e211feefdd8cce1b410f7
|
|
| BLAKE2b-256 |
43a87bfac057fc75660e15885e886413d4feba79c0e8cc3d977753e293050e18
|