lava-dnf


Namelava-dnf JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://lava-nc.org/
SummaryA library that provides processes and other software infrastructure to build architectures composed of Dynamic Neural Fields (DNF).
upload_time2024-08-08 05:50:33
maintainerNone
docs_urlNone
authorIntel's Neuromorphic Computing Lab and the open source community
requires_python<3.11,>=3.10
license(BSD-3-Clause)
keywords neuromorphic ai artificial intelligence neural models spiking neural networks dynamic neural fields dnf
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Dynamic Neural Fields

## Introduction

Dynamic Neural Fields (DNF) are neural attractor networks that generate
stabilized activity patterns in recurrently connected populations of neurons.
These activity patterns form the basis of neural representations, decision
making, working memory, and learning. DNFs are the fundamental
building block of [dynamic field theory](https://dynamicfieldtheory.org),
a mathematical and conceptual framework for modeling cognitive processes in
a closed behavioral loop.

![2D DNF tracking bias input](https://user-images.githubusercontent.com/5708333/135443996-7492b968-277a-4397-9b1c-597b7af4a699.gif)<br>
*Voltage of a selective dynamic neural field tracking moving input*

## What is lava-dnf?

lava-dnf is a library within the Lava software framework. The main building 
blocks in Lava are processes. lava-dnf provides
processes and other software infrastructure to build architectures composed of
DNFs. In particular, it provides functions that generate connectivity patterns
common to DNF architectures.

The primary focus of lava-dnf today is on robotic applications: sensing and
perception, motion control, behavioral organization, map formation, and
autonomous (continual) learning. Neuromorphic hardware provides significant
gains in both processing speed and energy efficiency compared to conventional
implementations of DNFs on a CPU or GPU (e.g., using
[cedar](https://cedar.ini.rub.de) or [cosivina](https://github.com/cosivina)).

## Key features

Building DNF architectures
- Based on spiking neurons
- DNF dimensionality support for 0D, 1D, 2D, and 3D
- Recurrent connectivity based on kernel functions
- Forward connectivity to connect multiple DNFs
- Structured input from spike generators

Running DNF architectures
- On CPU (Python simulation)
- On Loihi 2

Examples demonstrating basic DNF regimes and instabilities
- Detection of input
- Selection of input
- Working memory of input
- Relational networks


## Installation
We highly recommend cloning the repository and using poetry to set up lava-dnf, provided you only want to run lava-dnf 
in simulation. This will automatically also install lava. 

Note: For INRC members who want to run lava-dnf on Loihi 2 hardware, we recommend following the 
[install instructions for the Lava-on-Loihi extension](https://intel-ncl.atlassian.net/wiki/spaces/NAP/pages/1785856001/Setup+Lava+extension+for+Loihi).

#### Linux/MacOS
```bash
$ cd $HOME
$ git clone git@github.com:lava-nc/lava-dnf.git
$ cd lava-dnf
$ curl -sSL https://install.python-poetry.org | python3
$ poetry config virtualenvs.in-project true
$ poetry install
$ source .venv/bin/activate
$ pytest
```
#### Windows (PowerShell)
```cmdlet
# Commands using PowerShell
cd $HOME
git clone https://github.com/lava-nc/lava-dnf.git
cd lava-dnf
python -m venv .venv
set-executionpolicy remotesigned  # only required on first execution
.venv\Scripts\activate
curl.exe -sSL https://install.python-poetry.org | python -
# Include the directory where poetry was installed into the PATH variable.
pip install -U pip
poetry config virtualenvs.in-project true
poetry install
pytest
```
You should expect the following output after running the unit tests with `pytest`.
```
$ pytest
================================================= test session starts =================================================
platform win32 -- Python 3.9.12, pytest-7.2.0, pluggy-1.0.0
rootdir: C:\Users\username\lava-dnf, configfile: pyproject.toml, testpaths: tests
plugins: cov-3.0.0
collected 210 items

tests\lava\lib\dnf\acceptance\test_connecting_with_ops.py .......                                                [  3%]
tests\lava\lib\dnf\acceptance\test_gauss_spike_generator.py .                                                    [  3%]
tests\lava\lib\dnf\connect\test_connect.py .............                                                         [ 10%]
tests\lava\lib\dnf\connect\test_exceptions.py .                                                                  [ 10%]
[...]
tests\lava\lib\dnf\utils\test_plotting.py ....                                                                   [ 96%]
tests\lava\lib\dnf\utils\test_validation.py .....                                                                [ 98%]
tests\lava\tutorials\test_tutorials.py sss                                                                       [100%]

=============================== warnings summary ===============================
[...]

---------- coverage: platform win32, python 3.9.12-final-0 -----------
Name                                                     Stmts   Miss  Cover   Missing
--------------------------------------------------------------------------------------
src\lava\lib\dnf\connect\connect.py                         49      0   100%
src\lava\lib\dnf\connect\exceptions.py                       6      1    83%   20
[...]
src\lava\lib\dnf\utils\plotting.py                          29      0   100%
src\lava\lib\dnf\utils\validation.py                        18      2    89%   28, 38
--------------------------------------------------------------------------------------
TOTAL                                                      806     13    98%

Required test coverage of 65.0% reached. Total coverage: 98.39%
===================================== 207 passed, 3 skipped, 2 warnings in 28.78s =====================================
```

## Example

```python
from lava.proc.lif.process import LIF
from lava.lib.dnf.kernels.kernels import SelectiveKernel
from lava.lib.dnf.connect.connect import connect
from lava.lib.dnf.operations.operations import Convolution

# Create a population of 20x20 spiking neurons.
dnf = LIF(shape=(20, 20))

# Create a selective kernel.
kernel = SelectiveKernel(amp_exc=18, width_exc=[4, 4], global_inh=-15)

# Apply the kernel to the population to create a DNF with a selective regime.
connect(dnf.s_out, dnf.a_in, [Convolution(kernel)])
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://lava-nc.org/",
    "name": "lava-dnf",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.11,>=3.10",
    "maintainer_email": null,
    "keywords": "neuromorphic, ai, artificial intelligence, neural models, spiking neural networks, dynamic neural fields, dnf",
    "author": "Intel's Neuromorphic Computing Lab and the open source community",
    "author_email": "lava@intel.com",
    "download_url": "https://files.pythonhosted.org/packages/ed/a5/3952e483d26cb7bcc5a6f7fc0a3a2d19ac9fb590517cf5c537a02d148ebd/lava_dnf-0.3.0.tar.gz",
    "platform": null,
    "description": "# Dynamic Neural Fields\n\n## Introduction\n\nDynamic Neural Fields (DNF) are neural attractor networks that generate\nstabilized activity patterns in recurrently connected populations of neurons.\nThese activity patterns form the basis of neural representations, decision\nmaking, working memory, and learning. DNFs are the fundamental\nbuilding block of [dynamic field theory](https://dynamicfieldtheory.org),\na mathematical and conceptual framework for modeling cognitive processes in\na closed behavioral loop.\n\n![2D DNF tracking bias input](https://user-images.githubusercontent.com/5708333/135443996-7492b968-277a-4397-9b1c-597b7af4a699.gif)<br>\n*Voltage of a selective dynamic neural field tracking moving input*\n\n## What is lava-dnf?\n\nlava-dnf is a library within the Lava software framework. The main building \nblocks in Lava are processes. lava-dnf provides\nprocesses and other software infrastructure to build architectures composed of\nDNFs. In particular, it provides functions that generate connectivity patterns\ncommon to DNF architectures.\n\nThe primary focus of lava-dnf today is on robotic applications: sensing and\nperception, motion control, behavioral organization, map formation, and\nautonomous (continual) learning. Neuromorphic hardware provides significant\ngains in both processing speed and energy efficiency compared to conventional\nimplementations of DNFs on a CPU or GPU (e.g., using\n[cedar](https://cedar.ini.rub.de) or [cosivina](https://github.com/cosivina)).\n\n## Key features\n\nBuilding DNF architectures\n- Based on spiking neurons\n- DNF dimensionality support for 0D, 1D, 2D, and 3D\n- Recurrent connectivity based on kernel functions\n- Forward connectivity to connect multiple DNFs\n- Structured input from spike generators\n\nRunning DNF architectures\n- On CPU (Python simulation)\n- On Loihi 2\n\nExamples demonstrating basic DNF regimes and instabilities\n- Detection of input\n- Selection of input\n- Working memory of input\n- Relational networks\n\n\n## Installation\nWe highly recommend cloning the repository and using poetry to set up lava-dnf, provided you only want to run lava-dnf \nin simulation. This will automatically also install lava. \n\nNote: For INRC members who want to run lava-dnf on Loihi 2 hardware, we recommend following the \n[install instructions for the Lava-on-Loihi extension](https://intel-ncl.atlassian.net/wiki/spaces/NAP/pages/1785856001/Setup+Lava+extension+for+Loihi).\n\n#### Linux/MacOS\n```bash\n$ cd $HOME\n$ git clone git@github.com:lava-nc/lava-dnf.git\n$ cd lava-dnf\n$ curl -sSL https://install.python-poetry.org | python3\n$ poetry config virtualenvs.in-project true\n$ poetry install\n$ source .venv/bin/activate\n$ pytest\n```\n#### Windows (PowerShell)\n```cmdlet\n# Commands using PowerShell\ncd $HOME\ngit clone https://github.com/lava-nc/lava-dnf.git\ncd lava-dnf\npython -m venv .venv\nset-executionpolicy remotesigned  # only required on first execution\n.venv\\Scripts\\activate\ncurl.exe -sSL https://install.python-poetry.org | python -\n# Include the directory where poetry was installed into the PATH variable.\npip install -U pip\npoetry config virtualenvs.in-project true\npoetry install\npytest\n```\nYou should expect the following output after running the unit tests with `pytest`.\n```\n$ pytest\n================================================= test session starts =================================================\nplatform win32 -- Python 3.9.12, pytest-7.2.0, pluggy-1.0.0\nrootdir: C:\\Users\\username\\lava-dnf, configfile: pyproject.toml, testpaths: tests\nplugins: cov-3.0.0\ncollected 210 items\n\ntests\\lava\\lib\\dnf\\acceptance\\test_connecting_with_ops.py .......                                                [  3%]\ntests\\lava\\lib\\dnf\\acceptance\\test_gauss_spike_generator.py .                                                    [  3%]\ntests\\lava\\lib\\dnf\\connect\\test_connect.py .............                                                         [ 10%]\ntests\\lava\\lib\\dnf\\connect\\test_exceptions.py .                                                                  [ 10%]\n[...]\ntests\\lava\\lib\\dnf\\utils\\test_plotting.py ....                                                                   [ 96%]\ntests\\lava\\lib\\dnf\\utils\\test_validation.py .....                                                                [ 98%]\ntests\\lava\\tutorials\\test_tutorials.py sss                                                                       [100%]\n\n=============================== warnings summary ===============================\n[...]\n\n---------- coverage: platform win32, python 3.9.12-final-0 -----------\nName                                                     Stmts   Miss  Cover   Missing\n--------------------------------------------------------------------------------------\nsrc\\lava\\lib\\dnf\\connect\\connect.py                         49      0   100%\nsrc\\lava\\lib\\dnf\\connect\\exceptions.py                       6      1    83%   20\n[...]\nsrc\\lava\\lib\\dnf\\utils\\plotting.py                          29      0   100%\nsrc\\lava\\lib\\dnf\\utils\\validation.py                        18      2    89%   28, 38\n--------------------------------------------------------------------------------------\nTOTAL                                                      806     13    98%\n\nRequired test coverage of 65.0% reached. Total coverage: 98.39%\n===================================== 207 passed, 3 skipped, 2 warnings in 28.78s =====================================\n```\n\n## Example\n\n```python\nfrom lava.proc.lif.process import LIF\nfrom lava.lib.dnf.kernels.kernels import SelectiveKernel\nfrom lava.lib.dnf.connect.connect import connect\nfrom lava.lib.dnf.operations.operations import Convolution\n\n# Create a population of 20x20 spiking neurons.\ndnf = LIF(shape=(20, 20))\n\n# Create a selective kernel.\nkernel = SelectiveKernel(amp_exc=18, width_exc=[4, 4], global_inh=-15)\n\n# Apply the kernel to the population to create a DNF with a selective regime.\nconnect(dnf.s_out, dnf.a_in, [Convolution(kernel)])\n```\n\n",
    "bugtrack_url": null,
    "license": "(BSD-3-Clause)",
    "summary": "A library that provides processes and other software infrastructure to build architectures composed of Dynamic Neural Fields (DNF).",
    "version": "0.3.0",
    "project_urls": {
        "Discussions": "https://github.com/lava-nc/lava-dnf/discussions",
        "Frequently Asked Questions": "https://github.com/lava-nc/lava-dnf/wiki/Frequently-Asked-Questions-(FAQ)",
        "Homepage": "https://lava-nc.org/",
        "Issue and Bug Tracker": "https://github.com/lava-nc/lava-dnf/issues",
        "Questions and Answers": "https://github.com/lava-nc/lava-dnf/discussions/categories/q-a",
        "Repository": "https://github.com/lava-nc/lava-dnf.git"
    },
    "split_keywords": [
        "neuromorphic",
        " ai",
        " artificial intelligence",
        " neural models",
        " spiking neural networks",
        " dynamic neural fields",
        " dnf"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "19022a508ef3a55d5dcc809e766c53ba55873893cf3afc6bd191349f48cfdb48",
                "md5": "58e0d316b5e37c602887ce80e465b5b6",
                "sha256": "35593334847e04fff5ae61dea176e47cffeff5a8d718f975295df615e4e22d6b"
            },
            "downloads": -1,
            "filename": "lava_dnf-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "58e0d316b5e37c602887ce80e465b5b6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.11,>=3.10",
            "size": 63938,
            "upload_time": "2024-08-08T05:50:31",
            "upload_time_iso_8601": "2024-08-08T05:50:31.173809Z",
            "url": "https://files.pythonhosted.org/packages/19/02/2a508ef3a55d5dcc809e766c53ba55873893cf3afc6bd191349f48cfdb48/lava_dnf-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eda53952e483d26cb7bcc5a6f7fc0a3a2d19ac9fb590517cf5c537a02d148ebd",
                "md5": "07bf17034c2bb77bb60b40d65125fc40",
                "sha256": "c528fb28a37a0bd493200a90a5d0102536f33d081a1724ef0ad3185929303cf0"
            },
            "downloads": -1,
            "filename": "lava_dnf-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "07bf17034c2bb77bb60b40d65125fc40",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.11,>=3.10",
            "size": 11545444,
            "upload_time": "2024-08-08T05:50:33",
            "upload_time_iso_8601": "2024-08-08T05:50:33.009202Z",
            "url": "https://files.pythonhosted.org/packages/ed/a5/3952e483d26cb7bcc5a6f7fc0a3a2d19ac9fb590517cf5c537a02d148ebd/lava_dnf-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-08 05:50:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lava-nc",
    "github_project": "lava-dnf",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "lava-dnf"
}
        
Elapsed time: 0.37469s