DBGSOM


NameDBGSOM JSON
Version 1.0.1 PyPI version JSON
download
home_page
SummaryA directed batch growing self organizing map
upload_time2024-02-19 14:34:17
maintainer
docs_urlNone
authorSandro Martens
requires_python>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![license](https://img.shields.io/github/license/SandroMartens/DBGSOM)
![CircleCI](https://img.shields.io/circleci/build/github/SandroMartens/DBGSOM?label=CircleCI)
![readthedocs](https://img.shields.io/readthedocs/dbgsom)
![AppVeyor](https://img.shields.io/appveyor/build/SandroMartens/DBGSOM?label=Appveyor)
[![Python package](https://github.com/SandroMartens/DBGSOM/actions/workflows/python-package.yml/badge.svg)](https://github.com/SandroMartens/DBGSOM/actions/workflows/python-package.yml)

# DBGSOM

DBGSOM is short for _Directed batch growing self-organizing map_. A SOM is a type of artificial neural network that is used to to produce a low-dimensional  representation of a higher dimensional data set while preserving the topological structure of the data.  It can be used for unsupervised vector quantization, classification and many different data visualization tasks.

This project was inspired by the great [MiniSom](https://github.com/JustGlowing/minisom).

## Features

- Compatible with scikit-learn's API and can be used as a drop-in replacement for other clustering and classification algorithms
- Can handle high-dimensional and non-uniform data distributions
- Good results without parameter tuning
- Better topology preservation and faster training time than classical SOMs
- Interpretability of the results through plotting

## How it works

The DBGSOM algorithm works by constructing a two-dimensional map of prototypes (neurons) where each neuron is connected to its neighbors. The first neurons on the map are initialized with random weights from the input data. The input data is then presented to the SOM. Each sample gets assigned to it's nearest neuron. The neuron weights are then updated to the samples that were mapped to each neuron. Neighboring neurons affect each others updates, so the low dimensional ordering of the map is preserved. The DBGSOM algorithm uses a growing mechanism to expand the map as needed. New neurons are added to the edge of the map where the quantization error of the boundary neurons is above a given growing threshold.

## How to install

```PowerShell
pip install DBGSOM
```

## Usage

dbgsom implements the scikit-learn API.

```Python
from dbgsom import DBGSOM

quantizer = DBGSOM()
quantizer.fit(X=data_train)
labels_train = quantizer.labels_
labels_test = quantizer.predict(X=data_test)

```

## Examples

Here are a few example use cases for dbgsom (WiP)

|Example|Description|
|-|-|
|![example](examples/2d_example.png)| With a two dimensional input we can clearly see how the protoypes (red) approximate the input distribution (white) while still preserving the square topology to their neighbors.|
|![The fashion mnist dataset](examples/fashion_mnist.png) | After training the SOM on the fashion mnist dataset we can plot the nearest neighbor of each prototype. We can see that the SOM ordered the prototypes in a way that neighboring prototypes are pairwise similar. |
|![digits](examples/digits_classes.png) | We can show the majority class each prototype represents. Samples from the same class are clustered together. The SOM was train on mnist digits.|
|![darknet_pca](examples/darknet_pca.png) | We can use linear transformations like PCA to color code relative distances between prototypes in the input space. See _darknet_ example notebook.

## Dependencies

- Python > 3.7
- Numpy
- NetworkX
- tqdm
- scikit-learn
- seaborn
- pandas

## References

- _A directed batch growing approach to enhance the topology preservation of self-organizing map_, Mahdi Vasighi and Homa Amini, 2017, <http://dx.doi.org/10.1016/j.asoc.2017.02.015>
- Reference implementation by the authors in Matlab: <https://github.com/mvasighi/DBGSOM>
- _Statistics-enhanced Direct Batch Growth Self- organizing Mapping for efficient DoS Attack Detection_, Xiaofei Qu et al., 2019, [10.1109/ACCESS.2019.2922737](https://ieeexplore.ieee.org/document/8736234)
- _Entropy-Defined Direct Batch Growing Hierarchical Self-Organizing Mapping for Efficient Network Anomaly Detection_, Xiaofei Qu et al., 2021 10.1109/ACCESS.2021.3064200
- _Self-Organizing Maps_, 3rd Edition, Teuvo Kohonen, 2003
- _MATLAB Implementations and Applications of the Self-Organizing Map_, Teuvo Kohonen, 2014

## License

dbgsom is licensed under the MIT license.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "DBGSOM",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "",
    "author": "Sandro Martens",
    "author_email": "Sandro Martens <sandro.martens@web.de>",
    "download_url": "https://files.pythonhosted.org/packages/7b/f5/68ce6e0937d046a96152ab718e2666ea2d1f43e90b0daf2a99d83abc5067/DBGSOM-1.0.1.tar.gz",
    "platform": null,
    "description": "![license](https://img.shields.io/github/license/SandroMartens/DBGSOM)\r\n![CircleCI](https://img.shields.io/circleci/build/github/SandroMartens/DBGSOM?label=CircleCI)\r\n![readthedocs](https://img.shields.io/readthedocs/dbgsom)\r\n![AppVeyor](https://img.shields.io/appveyor/build/SandroMartens/DBGSOM?label=Appveyor)\r\n[![Python package](https://github.com/SandroMartens/DBGSOM/actions/workflows/python-package.yml/badge.svg)](https://github.com/SandroMartens/DBGSOM/actions/workflows/python-package.yml)\r\n\r\n# DBGSOM\r\n\r\nDBGSOM is short for _Directed batch growing self-organizing map_. A SOM is a type of artificial neural network that is used to to produce a low-dimensional  representation of a higher dimensional data set while preserving the topological structure of the data.  It can be used for unsupervised vector quantization, classification and many different data visualization tasks.\r\n\r\nThis project was inspired by the great [MiniSom](https://github.com/JustGlowing/minisom).\r\n\r\n## Features\r\n\r\n- Compatible with scikit-learn's API and can be used as a drop-in replacement for other clustering and classification algorithms\r\n- Can handle high-dimensional and non-uniform data distributions\r\n- Good results without parameter tuning\r\n- Better topology preservation and faster training time than classical SOMs\r\n- Interpretability of the results through plotting\r\n\r\n## How it works\r\n\r\nThe DBGSOM algorithm works by constructing a two-dimensional map of prototypes (neurons) where each neuron is connected to its neighbors. The first neurons on the map are initialized with random weights from the input data. The input data is then presented to the SOM. Each sample gets assigned to it's nearest neuron. The neuron weights are then updated to the samples that were mapped to each neuron. Neighboring neurons affect each others updates, so the low dimensional ordering of the map is preserved. The DBGSOM algorithm uses a growing mechanism to expand the map as needed. New neurons are added to the edge of the map where the quantization error of the boundary neurons is above a given growing threshold.\r\n\r\n## How to install\r\n\r\n```PowerShell\r\npip install DBGSOM\r\n```\r\n\r\n## Usage\r\n\r\ndbgsom implements the scikit-learn API.\r\n\r\n```Python\r\nfrom dbgsom import DBGSOM\r\n\r\nquantizer = DBGSOM()\r\nquantizer.fit(X=data_train)\r\nlabels_train = quantizer.labels_\r\nlabels_test = quantizer.predict(X=data_test)\r\n\r\n```\r\n\r\n## Examples\r\n\r\nHere are a few example use cases for dbgsom (WiP)\r\n\r\n|Example|Description|\r\n|-|-|\r\n|![example](examples/2d_example.png)| With a two dimensional input we can clearly see how the protoypes (red) approximate the input distribution (white) while still preserving the square topology to their neighbors.|\r\n|![The fashion mnist dataset](examples/fashion_mnist.png) | After training the SOM on the fashion mnist dataset we can plot the nearest neighbor of each prototype. We can see that the SOM ordered the prototypes in a way that neighboring prototypes are pairwise similar. |\r\n|![digits](examples/digits_classes.png) | We can show the majority class each prototype represents. Samples from the same class are clustered together. The SOM was train on mnist digits.|\r\n|![darknet_pca](examples/darknet_pca.png) | We can use linear transformations like PCA to color code relative distances between prototypes in the input space. See _darknet_ example notebook.\r\n\r\n## Dependencies\r\n\r\n- Python > 3.7\r\n- Numpy\r\n- NetworkX\r\n- tqdm\r\n- scikit-learn\r\n- seaborn\r\n- pandas\r\n\r\n## References\r\n\r\n- _A directed batch growing approach to enhance the topology preservation of self-organizing map_, Mahdi Vasighi and Homa Amini, 2017, <http://dx.doi.org/10.1016/j.asoc.2017.02.015>\r\n- Reference implementation by the authors in Matlab: <https://github.com/mvasighi/DBGSOM>\r\n- _Statistics-enhanced Direct Batch Growth Self- organizing Mapping for efficient DoS Attack Detection_, Xiaofei Qu et al., 2019, [10.1109/ACCESS.2019.2922737](https://ieeexplore.ieee.org/document/8736234)\r\n- _Entropy-Defined Direct Batch Growing Hierarchical Self-Organizing Mapping for Efficient Network Anomaly Detection_, Xiaofei Qu et al., 2021 10.1109/ACCESS.2021.3064200\r\n- _Self-Organizing Maps_, 3rd Edition, Teuvo Kohonen, 2003\r\n- _MATLAB Implementations and Applications of the Self-Organizing Map_, Teuvo Kohonen, 2014\r\n\r\n## License\r\n\r\ndbgsom is licensed under the MIT license.\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A directed batch growing self organizing map",
    "version": "1.0.1",
    "project_urls": {
        "Docmentation": "https://dbgsom.readthedocs.io/en/latest/",
        "Homepage": "https://github.com/SandroMartens/DBGSOM"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "87b83a846652222e91953a0854783b59f9cf70663b522652794017899992b807",
                "md5": "ab9fb5861686e3a6cb050bb2ae6854e4",
                "sha256": "b48d3c3e6d46a0644ae88d295745a218dbb5070e2e02627c6734d7bcefc209b7"
            },
            "downloads": -1,
            "filename": "DBGSOM-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ab9fb5861686e3a6cb050bb2ae6854e4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 15934,
            "upload_time": "2024-02-19T14:34:15",
            "upload_time_iso_8601": "2024-02-19T14:34:15.676679Z",
            "url": "https://files.pythonhosted.org/packages/87/b8/3a846652222e91953a0854783b59f9cf70663b522652794017899992b807/DBGSOM-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7bf568ce6e0937d046a96152ab718e2666ea2d1f43e90b0daf2a99d83abc5067",
                "md5": "e0471e9b2091b5514cad275d60d803f8",
                "sha256": "d49986ab77abc3c038565832d04c4de49465f5fbc8b844205350e35ed762a11e"
            },
            "downloads": -1,
            "filename": "DBGSOM-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e0471e9b2091b5514cad275d60d803f8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 15735,
            "upload_time": "2024-02-19T14:34:17",
            "upload_time_iso_8601": "2024-02-19T14:34:17.039891Z",
            "url": "https://files.pythonhosted.org/packages/7b/f5/68ce6e0937d046a96152ab718e2666ea2d1f43e90b0daf2a99d83abc5067/DBGSOM-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-19 14:34:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SandroMartens",
    "github_project": "DBGSOM",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "circle": true,
    "appveyor": true,
    "requirements": [],
    "lcname": "dbgsom"
}
        
Elapsed time: 0.24504s