BSD 3-Clause "New" or "Revised" License

技术解读

以下内容由 GitRead 中文社区 编辑团队基于项目 README 与官方资料整理, 结合中文开发者的常见使用场景补充技术选型建议。具体以项目官方文档为准。

NGC-Learn: 用 Python 探索计算神经科学与神经人工智能

NGC-Learn 是 NACLab 团队在 Github 上开源的神经计算实验项目。该项目致力于用 Python 探索计算神经科学和神经人工智能,为研究者提供一个强大的工具集,从基础的神经元模型到更为复杂的深度学习模型,都能在此找到丰富的实现和应用。

项目背景与痛点

在神经科学领域,传统的数学模型和技术难以全面模拟复杂的神经系统行为。NGC-Learn 出现的初衷正是为了解决这一问题,它通过提供一系列工具,允许研究者和开发者直观地模拟和研究神经系统的动力学行为,从而加速神经科学理论的研究和应用开发。借助 Python 这一高级编程语言,本项目成功地降低了神经科学研究的门槛,使得更多的开发者能够参与到这一前沿领域中。

神经科学与智能算法结合日益密切,而 NGC-Learn 则为其提供了一个开放的舞台。在这个舞台上,既有基础的生物神经系统模拟,也有探索性的神经算法实现,促进两者之间的知识交流和技术融合。

核心技术揭秘

NGC-Learn 的核心是由 Python 编写的,它不仅基于现有的神经科学理论,还结合了最新的人工智能技术成果。被集成的各种模型和算法使得它在神经科学实验研究中提供了一个强大的计算框架。大体上,项目通过设计良好的 API 提供了广泛的功能模块,例如大量预定义的神经元模型、便利的模拟器以及强大的数据分析工具,这极大地方便了用户对系统进行实验和研究。

以下是一个简化的数据流图,展示了 NGC-Learn 中数据分析模块处理数据的主要流程:

graph TD A[原始神经数据] --> B[数据预处理] B --> C{"数据分割"} C -->|"训练数据"| D[训练模型] C -->|"测试数据"| E[模型评估] D --> F[模型保存] F --> G[测试验证] E --> G G --> H[结果可视化]

从图中可以看到,数据从预处理到分割,然后进行模型训练与评估,最后将其结果以可视化形式呈现给用户。

功能亮点与差异

NGC-Learn 的其中一个关键亮点在于其高度灵活性和可扩展性。用户不仅可以使用已定义的神经元模型,还可以轻松地扩展和自定义模型以适应特定的研究需求。同时,NGC-Learn 中提供的广泛的数据分析工具,如数据可视化、模型评估等功能,也能全面支持研究者进行深入分析和理解。

在日趋激烈的神经科学研究中,NGC-Learn 通过提供高效的计算和分析工具,大大减少了研究人员和学生的入门时间,同时降低了研究成本。

应用场景与落地建议

项目尤其适用于学术研究领域,比如高校实验室和科研机构。使用NGC-Learn可以减少科研人员对基础工具的开发时间,使得资源可以集中投入到神经系统和神经智能算法的研究中。在开发阶段,开发者需要仔细调整参数,并深刻理解模拟系统的内部机制,以保证模型的准确性和稳定性。选择合适的硬件同样重要,建议通过 GPU 加速模拟,以提高计算效率。

在产环境落地时,高级科研成果在商业化后还需在实际应用中进行进一步调整和测试,如数据隐私与合规性处理、模型的持续优化,以确保其在商业环境中具有良好的可行性。

综合评价

优点上,NGC-Learn 提供了一个高效的实验平台,能够快速实现神经科学实验,并且灵活可扩展,易于使用。然而,项目也存在不足,例如部分模型还是偏向理论研究,离实际应用尚有距离。

NGC-Learn 强大的工具集和丰富的模块注定让其在神经科学研究领域中扮演重要角色,不断改进将推动其在更多实际场景中的应用。

README

Python VersionLicenseMaintenanceDocumentation StatusDOI

ngc-learn is a Python library for building, simulating, and analyzing biophysical / neurobiological systems, spiking neuronal networks, predictive coding circuitry, and biomimetic (NeuroAI) agents that learn in a biologically-plausible manner. This simulation toolkit, meant to support computational neuroscience and brain-inspired computing research, is built on top of JAX and is distributed under the 3-Clause BSD license.

It is currently maintained by the Neural Adaptive Computing (NAC) laboratory.

Documentation

Official documentation, including tutorials, can be found here. The model museum repo (ngc-museum), which implements several historical models, can be found here.

The official blog-post related to the source paper behind this software library can be found here.
You can find the related paper right here, which was selected to appear in the Nature Neuromorphic Hardware and Computing Collection in 2023 and was chosen as one of the Editors’ Highlights for Applied Physics and Mathematics in 2022.

Installation

Dependencies

ngc-learn requires:

  1. Python (>=3.12)
  2. NumPy (>=2.5.2)
  3. SciPy (>=1.18.1)
  4. ngcsimlib (>=3.1.1), (visit official page here)
  5. JAX (>=0.11.1) (to enable GPU use, make sure to install one of the CUDA variants)

ngc-learn 3.2.4 and later require Python 3.12 or newer as well as ngcsimlib >=3.1.1. ngc-learn’s plotting capabilities (routines within ngclearn.utils.viz) require Matplotlib (>=3.11.1) and imageio (>=2.37.4) and both plotting and density estimation tools (routines within ngclearn.utils.density) will require Scikit-learn (>=1.9.0). Many of the tutorials will require Matplotlib (>=3.11.1), imageio (>=2.37.4), and Scikit-learn (>=1.9.0).

Note: If you are working with Cuda 12 and want to use jax/jaxlib versions > 0.4.28, you might need to check that you are working with the right version of Cudnn (e.g., nvidia-cudnn-cu12==9.10.2.21) to ensure that all of ngc-learn’s internal supported tools, like in-built convolution/deconvolution, compile correctly onto the GPU (if using an architecture based on Pascal GPUs, i.e., Compute Capability 6.1, combined with NVIDIA Driver 580+).

Important Note for Legacy GPU Users (Pascal Architecture)

If you are running JAX (> 0.4.28) on CUDA 12 using an older Pascal-generation GPU (Compute Capability 6.1, e.g., GTX 1080/1080Ti, Titan X) combined with NVIDIA Driver 580+, you might encounter compilation crashes during convolution/deconvolution operations (such as unknown cudnn status: 5003).

Newer versions of nvidia-cudnn-cu12 have dropped critical hardware support for these legacy architectures. To fix this and ensure ngclearn compiles correctly on your GPU, you will need to explicitly “pin” your cuDNN library version using this command (after installing Cuda-12 JAX):

pip install --force-reinstall "nvidia-cudnn-cu12==9.10.2.21"

User Installation

Setup: The easiest way to install ngc-learn is through pip:

$ pip install ngclearn

Note that installing the official pip package without any form of JAX installed on your system will default to downloading the CPU version of ngc-learn; make sure you have installed the Cuda 12 version of Jax/Jaxlib on your system before running the above pip command if you want to use the GPU version.

The documentation includes more detailed installation instructions. Note that this library was developed on Ubuntu 20.04/22.04 and tested on Ubuntu(s) 20.04 and 22.04.

If the installation was successful, you should see the following if you test it against your Python interpreter, i.e., run the $ python command and complete the following sequence of steps as depicted in the screenshot below (you should see at the bottom of your output something akin to the right major and minor version of ngc-learn):

Python 3.12.13 (main, MONTH  DAY YEAR, TIME) [GCC XX.X.X] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ngclearn
>>> ngclearn.__version__
'3.2.4'

Note: For access to the previous Tensorflow-2 version of ngc-learn (of which we no longer support), please visit the repo for ngc-learn-legacy.

Attribution:

If you use this code in any form in your project(s), please cite its source paper (as well as ngc-learn’s official software citation):

@article{Ororbia2022,
  author={Ororbia, Alexander and Kifer, Daniel},
  title={The neural coding framework for learning generative models},
  journal={Nature Communications},
  year={2022},
  month={Apr},
  day={19},
  volume={13},
  number={1},
  pages={2064},
  issn={2041-1723},
  doi={10.1038/s41467-022-29632-7},
  url={https://doi.org/10.1038/s41467-022-29632-7}
}

Development:

We warmly welcome community contributions to this project. For details on how to make a contribution to ngc-learn, please see our contributing guidelines.

Source Code You can check/pull the latest source code for this library via:

$ git clone https://github.com/NACLab/ngc-learn.git

If you are working on and developing with ngc-learn pulled from the github repo, then run the following command to set up an editable install:

$ python install -e .

Version:
3.2.4

Author: Alexander G. Ororbia II
Director, Neural Adaptive Computing (NAC) Laboratory
Rochester Institute of Technology, Department of Computer Science

Copyright:

Copyright © 2021 The Neural Adaptive Computing Laboratory - All Rights Reserved
You may use, distribute and modify this code under the terms of the BSD 3-clause license.

You should have received a copy of the BSD 3-clause license with this software.
If not, please email us

评论

暂无评论