SOM utils
Project description
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.
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nm-0.0.5.tar.gz.
File metadata
- Download URL: nm-0.0.5.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b03b63263522aad28ce11353b99225bc6550aabf0c2733076bc623c33f72bb1
|
|
| MD5 |
c9c8b0526de9b7efa2cc7e2705dbff5e
|
|
| BLAKE2b-256 |
6f8fc7e121b7164a30e6d5379ae324754e212b85c5197f4a93aa3a66b646ad13
|
File details
Details for the file nm-0.0.5-py3-none-any.whl.
File metadata
- Download URL: nm-0.0.5-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c369f4ff2205784cd66dccdf09e9c15b9a2c98b0df892fff523985cff4e0c885
|
|
| MD5 |
c58dc4f2dfd2fc8caf917c31301101c8
|
|
| BLAKE2b-256 |
214c8983c2e681bf0796a4710889361fbffb72b8d73f0e9a3d050f7f24b5e074
|