This is a modified version of Python code for applying SOM and LVQ algorithms in classification problems. This package also supports combining multiple networks of SOM-LVQ.
Installing the package as a library in Python by the command.
pip install git+https://github.com/KienMN/Modified-SOM.git
numpy
pandas
scikit-learn
Importing suitable model class from 'detection' package. Then, creating an instance for training and predicting.
Here is several sample lines of code. Specific documentation of each model class, attributes and methods are included in source code.
from detection.competitive_network import CombineSomLvq
model = CombineSomLvq(n_rows = 10, n_cols = 10)
model.fit(X_train, y_train)
model.predict(X_test)
Cloning project from github by command.
git clone https://github.com/KienMN/Modified-SOM.git
Project structure is shown below.
SOM/
├── MANIFEST.in // include non-code file
├── detection // main package
├── docs // documentations
├── setup.py // setup file
└── tests // testcases files
Test cases are written following format of unittest module. Run test files by command.
python3 tests/{package}/{test_file_name}.py