Skip to main content
LAMINR Logo  

Open in Colab PyPI version ICLR 2025 Paper

LAMINR (Learning and Aligning Manifolds of Single-Neuron Invariances using Implicit Neural Representations) enables the systematic discovery and alignment of invariance manifolds in stimulus space for visual sensory neurons, providing a principled way to characterize and compare neuronal invariances at the population level, independent of nuisance receptive field properties such as position, size, and orientation.

🚀 Highlights

  • Continuous Invariance Manifold Learning: Identifies the full space of stimuli that elicit near-maximal responses from a neuron.
  • Alignment Across Neurons: Learns transformations that align invariance manifolds across neurons, revealing shared invariance properties.
  • Functional Clustering: Enables clustering neurons into distinct functional types based on their invariance properties.
  • Model-Agnostic: Can be applied to any robust response-predicting model of biological neurons.
Method Overview

🛠 Installation

You can install LAMINR using one of the following methods:

1️⃣ Using pip

pip install laminr

2️⃣ Via GitHub (Latest Version)

pip install git+https://github.com/sinzlab/laminr.git

🔥 Quick Start

Here's a simple example of how to use LAMINR to learn and align invariance manifolds.

Open in Colab

from laminr import neuron_models, get_mei_dict, InvarianceManifold

device = "cuda"
input_shape = [1, 100, 100]  # (channels, height, width)

# Load the trained neuron model
model = neuron_models.simulated("demo1", img_res=input_shape[1:]).to(device)

# Generate MEIs (Maximally Exciting Inputs)
image_constraints = {
    "pixel_value_lower_bound": -1.0,
    "pixel_value_upper_bound": 1.0,
    "required_img_norm": 1.0,
}
meis_dict = get_mei_dict(model, input_shape, **image_constraints)

# Initialize the invariance manifold pipeline
inv_manifold = InvarianceManifold(model, meis_dict, **image_constraints)

# Learn invariance manifold for neuron 0 (template)
template_idx = 0
template_imgs, template_activations = inv_manifold.learn(template_idx)

# Align the template to neurons 1 and 2
target_idxs = [1, 2]
aligned_imgs, aligned_activations = inv_manifold.match(target_idxs)

🐳 Running with Docker

We have provided a Dockerfile for building an image with LAMINR pre-installed. Ensure that both docker and docker-compose are installed on your system.

Follow the steps below to run LAMINR inside a Docker container with Jupyter Lab.

1. Clone the repository and navigate to the project directory:

git clone https://github.com/sinzlab/laminr.git
cd laminr

2. Run the following command inside the directory:

docker compose run -p 10101:8888 examples

This command:

  • Builds the Docker image and creates a container.
  • Exposes Jupyter Lab on port 10101.

3. Access Jupyter Lab: Jupyter Lab will launch in the examples folder, which you can open in your browser via localhost:10101 (the token can be found in the terminal logs).

🛠 Questions & Contributions

If you encounter any issues while using the method, please create an Issue on GitHub.

We welcome and appreciate contributions to the package! Feel free to open an Issue or submit a Pull Request for new features.

For other questions or project collaboration inquiries, please contact mohammadbashiri93@gmail.com or loocabaroni@gmail.com.

📜 License

This package is licensed under the Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) License. Briefly:

  • Attribution Required: You must credit the original authors and indicate if changes were made.
  • NonCommercial Use Only: This package may not be used for commercial purposes without explicit permission.
  • No Additional Restrictions: You may not apply legal terms that prevent others from using this package under these terms.

For full details, see the CC BY-NC 4.0 License.
For commercial use inquiries, please contact: mohammadbashiri93@gmail.com.

📖 Paper

ICLR 2025 (Oral): Learning and Aligning Single-Neuron Invariance Manifolds in Visual Cortex
Authors: Mohammad Bashiri*, Luca Baroni*, Ján Antolík, Fabian H. Sinz. (* denotes equal contribution)

Please cite our work if you find it useful:

@inproceedings{bashiri2025laminr,
  title={Learning and Aligning Single-Neuron Invariance Manifolds in Visual Cortex},
  author={Bashiri, Mohammad and Baroni, Luca and Antolík, Ján and Sinz, Fabian H.},
  booktitle={International Conference on Learning Representations (ICLR)},
  year={2025}
}

Metadata

Release files for laminr 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for laminr 0.0.7
File Size Uploaded Provenance Actions
laminr-0.0.7.tar.gz 122.3 kB Without provenance Details for laminr-0.0.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for laminr 0.0.7
File Interpreter ABI Platform Actions
laminr-0.0.7-py3-none-any.whl Python 3 none any Details for laminr-0.0.7-py3-none-any.whl

Total release size: 273.8 kB

Release files / laminr-0.0.7.tar.gz

Download URL laminr-0.0.7.tar.gz
Size 122.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9570c84d3b0935d0d782beb63e94bdace1460caf3d1a5bedcf75bb9c077f7b12
BLAKE2b-256 checksum
How to use checksums
f40ef75c29d94bbeefe515bdabc2651cd3c07011f4be2f94362ad932692bda8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Release files / laminr-0.0.7-py3-none-any.whl

Download URL laminr-0.0.7-py3-none-any.whl
Size 151.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
130c35c55c73be824bfbeaac99383f86616d4325bbab2e191c7340d636508c02
BLAKE2b-256 checksum
How to use checksums
074ab24191c04a67ca5bb2d933b547984032f29946e87d61223433c526603616
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Security for laminr 0.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page