mgng
Project description
Welcome to mgng
An experimental implementation of the Merge Growing Neural Gas algorithm. The project turned into an exercise for using state-of-the-art python tools. This project has been created with my cookiecutter for science projects
The Growing Neural Gas and Merge Growing Neural Gas Algorithms
Growing Neural Gas (NGN) is a topology preserving (see this blog for a demonstration) or this explaination) extension to the Neural gas (NG) approach is usefull for learning when an underlying topology is not known (as in the case of the Self-organizing maps (SOM) algorithm). When it comes to time series data (such as trajectories), an extension to the neural gas algorithm has been approached (Merge Neural Gas (MNG)) and a combination with the GNG leads to the Merge growing neural gas (MNGN) approach. It adds a context memory to the neurons of the NGN and is useful for recognising temporal sequences and with a single weighting parameter, can be reduced to a regular NGN for which an implementation is available.
This packages implements the MGNG algorithm as a vanilla numpy implementation (which can be executed on the GPU with Cupy). The package uses modern python tools such as poetry, attrs (a focus has been laid on those two for this release), and sphinx and mypy/pylint/black for documentation and coding standards.
See the notebooks in the repective subfolder of the project root and the documentation.
Installation and development
First make sure to install Python (^3.7) the dependency management tool Poetry then create an isolated virtual environment and install the dependencies:
poetry install
Per terminal session, the following command should be executed to activate the virtual environment.
poetry shell
To generate the documentation run:
cd doc/
make api # optional, only when the code base changes
make html
To run unit tests, run:
pytest --log-level=WARNING
# Specify a selected test
pytest --log-level=DEBUG -k "TestExample"
pytest --log-level=DEBUG tests/test_example.py::TestExample::test_example
To work with VisualStudio Code:
cp .vscode/template.settings.json .vscode/settings.json
which python # copy the path without the executable
and add the path to the virtual environment to in the "python.pythonPath"
setting.
cp .vscode/template.settings.json .vscode/settings.json
which python # copy the path without the executable
and add the path to the virtual environment to in the "python.pythonPath"
setting.
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
Hashes for lemonpy_mgng-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a18c4ad6d2303de0eb1d0a95f40cc24fa1fe0fcc8c7b9f334e010ba566a33e79 |
|
MD5 | 7a2ef572c00bbafdc1e6eee15d125945 |
|
BLAKE2b-256 | 301e895343a3f129731745fddff975ef0b81be1394106aec333477e667660d11 |