nm
SOM utils
To install: pip install nm
Overview
The nm package provides a Python implementation of Self-Organizing Maps (SOMs), a type of unsupervised learning neural network that is used to produce a low-dimensional (typically two-dimensional), discretized representation of the input space of the training samples. This implementation includes various functionalities such as data normalization, initialization methods, training processes, and visualization tools.
Main Features
- Normalization: Support for data normalization which is crucial for effective SOM training.
- Initialization Methods: Includes PCA-based and random initialization to start the SOM training.
- Training: Supports both batch and sequential training methods.
- Visualization: Functions to visualize the SOM's codebooks and the mapping from data space to SOM space.
- Projection: Ability to project new data onto the trained SOM.
- Clustering: Utilize the trained SOM for clustering data.
- Utility Functions: Additional functions for data denormalization, finding k-nearest nodes, etc.
Usage
Initialization
To create a SOM instance:
from nm import SOM
som = SOM(name="My_SOM", Data=my_data, mapsize=[20, 30], norm_method='var', initmethod='pca', neigh='Gaussian')
Training
To train the SOM:
som.train(n_job=1, shared_memory='no', verbose='on')
Visualization
To visualize the trained SOM:
som.view_map(what='codebook', which_dim='all', pack='Yes', text_size=10, save='No', grid='Yes', text='Yes')
Project Data
To project new data onto the trained SOM and find the best matching units (BMUs):
new_data_projection = som.project_data(new_data)
Clustering
To perform clustering on the map nodes:
cluster_labels = som.cluster(method='Kmeans', n_clusters=8)
Prediction
To predict using the trained SOM:
predicted_values = som.predict(X_test)
Documentation
Each function in the SOM class is well documented with docstrings, providing details on the parameters, the expected inputs, and outputs. Users are encouraged to refer to these docstrings for more detailed usage instructions.
Installation
This package can be installed using pip:
pip install nm
Requirements
This package depends on several external libraries including:
- NumPy
- Matplotlib
- Scikit-learn
- Joblib
- NumExpr
- SciPy
Ensure these are installed in your Python environment to use nm package effectively.
Metadata
Release files for nm 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nm-0.0.5.tar.gz | 18.0 kB | Without provenance | Details for nm-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nm-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for nm-0.0.5-py3-none-any.whl |
Total release size: 35.0 kB
Release files / nm-0.0.5.tar.gz
| Download URL | nm-0.0.5.tar.gz |
|---|---|
| Size | 18.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b03b63263522aad28ce11353b99225bc6550aabf0c2733076bc623c33f72bb1
|
|
BLAKE2b-256 checksum How to use checksums |
6f8fc7e121b7164a30e6d5379ae324754e212b85c5197f4a93aa3a66b646ad13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Release files / nm-0.0.5-py3-none-any.whl
| Download URL | nm-0.0.5-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c369f4ff2205784cd66dccdf09e9c15b9a2c98b0df892fff523985cff4e0c885
|
|
BLAKE2b-256 checksum How to use checksums |
214c8983c2e681bf0796a4710889361fbffb72b8d73f0e9a3d050f7f24b5e074
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Security for nm 0.0.5
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.