Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Topographic error for hexa lattice and partitioned errors for when data is too big (memory not enough for errors calculations) #96

Open
wants to merge 426 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
426 commits
Select commit Hold shift + click to select a range
27450c2
minor version update
JustGlowing Feb 20, 2019
2f86662
minor release update
JustGlowing Feb 20, 2019
4f7152b
Examples reorganized
JustGlowing Feb 22, 2019
e77485e
weights normalization not performed during training
JustGlowing Feb 22, 2019
36396c3
new color qunt image
JustGlowing Feb 22, 2019
89620b8
outliers detection example
JustGlowing Feb 27, 2019
2fc5484
outliers detection image
JustGlowing Feb 28, 2019
f03d0b8
Update Readme.md
JustGlowing Feb 28, 2019
da0d540
outlirs detection example updated
JustGlowing Feb 28, 2019
b12f1a9
democracy index example data upload
JustGlowing Feb 28, 2019
9514240
Merge branch 'master' of https://github.com/JustGlowing/minisom
JustGlowing Feb 28, 2019
3d5b533
outlier detection example update
JustGlowing Feb 28, 2019
7f2d122
random initialization from data not normalized
JustGlowing Mar 5, 2019
2bf23a9
travelling salesman example
JustGlowing Mar 5, 2019
0935578
rm old comment
JustGlowing Mar 5, 2019
f36205c
sample image update
JustGlowing Mar 7, 2019
e0d477d
comments improved
JustGlowing Mar 8, 2019
f92356c
new citation
JustGlowing Apr 3, 2019
91762e1
quant error printed if verbose
JustGlowing Apr 12, 2019
febe775
Merge branch 'master' of https://github.com/JustGlowing/minisom
JustGlowing Apr 12, 2019
f31396a
Update Readme.md
JustGlowing May 9, 2019
d80a39a
some more citations
JustGlowing May 16, 2019
47c985e
more citations
JustGlowing May 16, 2019
79f1440
new tutorial mentioned
JustGlowing May 17, 2019
d996a21
new tutorial
JustGlowing May 17, 2019
273221e
new citation
JustGlowing May 17, 2019
c08a7d0
link fixed
JustGlowing May 18, 2019
7f44cc7
speed up in update method
May 28, 2019
3a4a897
codestyle correction
May 29, 2019
0a26419
Merge pull request #33 from Sourmpis/master
JustGlowing May 30, 2019
6c0390f
comment on update method
JustGlowing May 30, 2019
dc1492e
minor codestyle change
JustGlowing May 30, 2019
65d128c
Update Readme.md
JustGlowing May 30, 2019
368989c
iris pies chart legend relocated
JustGlowing May 31, 2019
616fbaf
Merge branch 'master' of https://github.com/JustGlowing/minisom
JustGlowing May 31, 2019
59a626b
readme update
JustGlowing May 31, 2019
04711d5
classify method added
JustGlowing May 31, 2019
bba7cb5
test for picklability
JustGlowing May 31, 2019
6f0b711
new citation
JustGlowing Jun 4, 2019
3e5f558
new citation
JustGlowing Jun 7, 2019
0105707
python2.7 compatibility
JustGlowing Jun 24, 2019
808554e
Merge branch 'master' of https://github.com/JustGlowing/minisom
JustGlowing Jun 24, 2019
04b25a5
minor change
JustGlowing Jun 24, 2019
536003f
unused lines removed
JustGlowing Jul 4, 2019
04d79af
Update Readme.md
JustGlowing Jul 8, 2019
692cac6
new citation
JustGlowing Jul 8, 2019
7da128f
fixed it/s indicator (was s/it)
fgiobergia Jul 17, 2019
2d9de34
Merge pull request #38 from fgiobergia/master
JustGlowing Jul 17, 2019
0132a4d
moved classification in examples
JustGlowing Jul 18, 2019
99b231d
classification notebook
JustGlowing Jul 18, 2019
e358ae3
new citation
JustGlowing Aug 10, 2019
f20987a
pca bug fixed
JustGlowing Aug 13, 2019
711de0e
Merge branch 'master' of https://github.com/JustGlowing/minisom
JustGlowing Aug 13, 2019
968a4b7
book covers viz
JustGlowing Aug 13, 2019
ab0b000
training time left printed
JustGlowing Aug 13, 2019
2c308a7
training time left printed
JustGlowing Aug 13, 2019
1632398
new release
JustGlowing Aug 13, 2019
79abde7
new citation
JustGlowing Aug 14, 2019
b38b604
Vectorized the _activate function and weight normalization code, and …
AustinT Aug 15, 2019
c0f602b
Merge pull request #41 from AustinT/master
JustGlowing Aug 16, 2019
4abb66e
new citation
JustGlowing Aug 19, 2019
f8b4994
old example ported to python 3
JustGlowing Aug 23, 2019
be8a373
Merge branch 'master' of https://github.com/JustGlowing/minisom
JustGlowing Aug 23, 2019
c4ac881
new video tutorial
JustGlowing Aug 29, 2019
2f6e3eb
new citation
JustGlowing Sep 6, 2019
28df5e4
More comments for Iris.ipynb.
FeiYao-Edinburgh Sep 6, 2019
53cdcd6
Merge pull request #42 from FeiYao-Edinburgh/master
JustGlowing Sep 6, 2019
ee26378
bug fix
JustGlowing Sep 6, 2019
ef7aea9
Merge branch 'master' of https://github.com/JustGlowing/minisom
JustGlowing Sep 6, 2019
1c79311
doc improvement
JustGlowing Sep 6, 2019
86af015
doc improvement
JustGlowing Sep 6, 2019
26d371f
new release
JustGlowing Sep 6, 2019
9de0954
Typos fixed
JustGlowing Sep 9, 2019
6561db3
Correct a typo
FeiYao-Edinburgh Sep 9, 2019
4450503
Merge pull request #45 from FeiYao-Edinburgh/patch-1
JustGlowing Sep 10, 2019
b55a428
topographic error added
JustGlowing Sep 10, 2019
0d5f7b9
code simplifications
JustGlowing Sep 10, 2019
fca21e8
Readme more lean
JustGlowing Sep 11, 2019
a9df3f0
filename change for consistency
JustGlowing Sep 11, 2019
d403c59
topological error
JustGlowing Sep 18, 2019
c45c355
Merge branch 'master' of https://github.com/JustGlowing/minisom
JustGlowing Sep 18, 2019
cf4bdc3
new citation
JustGlowing Sep 27, 2019
1e67c25
Update Readme.md
JustGlowing Sep 27, 2019
3afe36d
fix div by zero
JustGlowing Oct 3, 2019
0bc2f58
new citation
JustGlowing Oct 4, 2019
51dcc82
remoed it/s to keep minisom cross platform
JustGlowing Oct 8, 2019
721fc39
progress bar bug fix
JustGlowing Oct 8, 2019
b757752
train wrappers fixed
JustGlowing Oct 15, 2019
b57e8d1
Update Readme.md
JustGlowing Nov 25, 2019
583e58f
new citation
JustGlowing Dec 4, 2019
be60efb
Fixed incorrect implementation of topographic_error() method. Changed…
Dec 6, 2019
b3d86df
Modified to pass the unit test and style check.
Dec 6, 2019
d304ed5
Fixed pylint problem.
Dec 7, 2019
60e7943
internal random generator used for indexes
JustGlowing Dec 9, 2019
1633289
Merge branch 'master' of https://github.com/JustGlowing/minisom
Dec 10, 2019
d467203
fixed topographic error
JustGlowing Dec 10, 2019
9aa96c6
topographic error in iris notebook
JustGlowing Dec 10, 2019
2635a86
Changed some variable names. Added unit test for _distance_from_weigh…
Dec 11, 2019
3cb87f7
Merge branch 'master' into master
wei-zhang-thz Dec 11, 2019
3b175e1
Fixed unit test. Fixed formating.
Dec 12, 2019
0f997a9
Merge pull request #55 from wei-zhang-thz/master
JustGlowing Dec 12, 2019
84e7ed9
quantization now faster
JustGlowing Dec 12, 2019
e98f1ec
release preparation
JustGlowing Dec 12, 2019
81214ff
Update Readme.md
JustGlowing Dec 13, 2019
65c28bb
Add documentation for MiniSom class
vezeli Dec 16, 2019
f0812a1
Merge pull request #57 from vezeli/master
JustGlowing Dec 16, 2019
5e5ea5a
classification example updated
JustGlowing Dec 17, 2019
8970572
New citations
JustGlowing Dec 27, 2019
a573612
New citation
JustGlowing Dec 27, 2019
9c5481e
color mapping example
JustGlowing Jan 10, 2020
9a93cf4
warnings improved
JustGlowing Jan 29, 2020
4567bfb
new citations
JustGlowing Feb 4, 2020
f15f228
link fixed
JustGlowing Feb 4, 2020
b27d77a
classification example updated
JustGlowing Feb 25, 2020
9da7e89
Merge branch 'master' of github.com:JustGlowing/minisom
JustGlowing Feb 25, 2020
3d8c93b
new citation
JustGlowing Feb 25, 2020
15d3599
quantization error changed
JustGlowing Mar 3, 2020
6221266
Merge branch 'master' of github.com:JustGlowing/minisom
JustGlowing Mar 3, 2020
8877db2
Update Readme.md
JustGlowing Mar 10, 2020
220a1e5
Update Readme.md
JustGlowing Mar 10, 2020
697ab35
Initialized empty notebook
V-for-Vaggelis Mar 20, 2020
fb2e913
Load and plot democracy-index data
V-for-Vaggelis Mar 20, 2020
8a46c77
Add feature selection function
V-for-Vaggelis Mar 20, 2020
f47b100
Added other simple selection methods
V-for-Vaggelis Mar 20, 2020
82ff818
Added markdown description
V-for-Vaggelis Mar 20, 2020
35a402e
Update Readme.md
JustGlowing Mar 25, 2020
f7c7ec2
clustering example added
JustGlowing Mar 28, 2020
fe34630
Merge branch 'master' of github.com:JustGlowing/minisom
JustGlowing Mar 28, 2020
6d5887a
clustering example updated
JustGlowing Mar 28, 2020
087142e
clustering example updated
JustGlowing Mar 29, 2020
9f936da
clustering example looks nicer
JustGlowing Mar 29, 2020
08537cc
Update Readme.md
JustGlowing Mar 31, 2020
c416428
Update Readme.md
JustGlowing Mar 31, 2020
4b356c6
activation distance added
JustGlowing Apr 13, 2020
d04ee7a
Merge branch 'master' of github.com:JustGlowing/minisom
JustGlowing Apr 13, 2020
56bf7b8
mahattan distance added
JustGlowing Apr 13, 2020
3c5ea8c
activation distance methods
JustGlowing Apr 14, 2020
ab2ce43
TSP updated
JustGlowing Apr 15, 2020
79d2917
classification example updated
JustGlowing Apr 16, 2020
2252197
Update Readme.md
JustGlowing Apr 17, 2020
e58a567
Update Readme.md
JustGlowing Apr 17, 2020
4e60815
hexagonal topology support
JustGlowing Apr 23, 2020
bf9e306
Merge branch 'master' of github.com:JustGlowing/minisom
JustGlowing Apr 23, 2020
7a3d3aa
Update Readme.md
JustGlowing Apr 24, 2020
3096ac0
Update Readme.md
JustGlowing Apr 24, 2020
b1d674d
haxagonal iris plot
JustGlowing Apr 24, 2020
63b36a7
Merge branch 'master' of github.com:JustGlowing/minisom
JustGlowing Apr 24, 2020
2bfce11
Hexagonal topology example
JustGlowing Apr 24, 2020
bbe1516
Update Readme.md
JustGlowing Apr 25, 2020
864a474
examples update
JustGlowing Apr 25, 2020
3d81743
examples updated
JustGlowing Apr 25, 2020
2459b99
figures update
JustGlowing Apr 25, 2020
06ef5fe
figures update
JustGlowing Apr 25, 2020
4a6c1cf
setup script polished
JustGlowing Apr 27, 2020
9b40d9f
Update Readme.md
JustGlowing Apr 27, 2020
1c2c55c
hexagonal topology example update
JustGlowing Apr 28, 2020
53e4114
Merge branch 'master' of github.com:JustGlowing/minisom
JustGlowing Apr 28, 2020
86afc32
hotfix
JustGlowing Apr 29, 2020
b14831d
Update Readme.md
JustGlowing May 2, 2020
abb8f75
Update Readme.md
JustGlowing May 7, 2020
4b40deb
Fix docstring
Sylfrena May 9, 2020
0fdcf0c
Merge pull request #69 from Sylfrena/fix
JustGlowing May 9, 2020
ee26c4a
Update Readme.md
JustGlowing May 21, 2020
00e44e4
compatibility note update
JustGlowing May 26, 2020
64f370f
Update Readme.md
JustGlowing May 27, 2020
35e32cf
Update Readme.md
JustGlowing Jun 1, 2020
cd935df
Update Readme.md
JustGlowing Jun 13, 2020
85f9d7d
chebyshev distance
JustGlowing Jun 19, 2020
c60b874
Merge branch 'master' of github.com:JustGlowing/minisom
JustGlowing Jun 19, 2020
a71a221
Update Readme.md
JustGlowing Jun 19, 2020
5035865
Update Readme.md
JustGlowing Jun 19, 2020
600d2c5
Renamed notebook and fixed description
V-for-Vaggelis Jun 21, 2020
c1e6786
Merge pull request #71 from V-for-Vaggelis/feature-selection-example
JustGlowing Jun 22, 2020
63e5af5
Update Readme.md
JustGlowing Jun 23, 2020
cb041d0
comments to classification example
JustGlowing Jun 23, 2020
1ede7c2
comments on clustering example
JustGlowing Jun 23, 2020
517e619
comments on color quant example
JustGlowing Jun 23, 2020
4a74447
comments color space mapping
JustGlowing Jun 23, 2020
1a97c00
dm index example commented
JustGlowing Jun 23, 2020
d6d81f3
more comments on example
JustGlowing Jun 23, 2020
3afde92
comments to topic modelling example
JustGlowing Jun 29, 2020
3994974
outlier detection documented
JustGlowing Jun 29, 2020
951923f
basic usage polished
JustGlowing Jun 30, 2020
dfb9ea0
minor changes
JustGlowing Jun 30, 2020
18d9853
removed iris
JustGlowing Jul 6, 2020
32f2f6a
Update Readme.md
JustGlowing Jul 6, 2020
7a0045b
removing more iris
JustGlowing Jul 6, 2020
16c8a86
Merge branch 'master' of github.com:JustGlowing/minisom
JustGlowing Jul 6, 2020
cc23e83
del iris dataset
JustGlowing Jul 6, 2020
764c866
Update Readme.md
JustGlowing Jul 6, 2020
3c7417e
removed iris from clustering too
JustGlowing Jul 6, 2020
c43bc8f
Merge branch 'master' of github.com:JustGlowing/minisom
JustGlowing Jul 6, 2020
b5c3e21
removing last bits of iris
JustGlowing Jul 6, 2020
9be1a4e
minor update
JustGlowing Jul 8, 2020
bf0e4ec
Update Readme.md
JustGlowing Jul 18, 2020
131656f
Update minisom.py
khac Jul 20, 2020
04a738d
Update minisom.py
khac Jul 20, 2020
aa61278
Merge pull request #73 from khac/patch-1
JustGlowing Jul 20, 2020
f0eb199
new visualization
JustGlowing Jul 21, 2020
ad29cd4
Merge branch 'master' of github.com:JustGlowing/minisom
JustGlowing Jul 21, 2020
c790380
main chart resize
JustGlowing Jul 21, 2020
193fa57
basic usage doc update
JustGlowing Jul 22, 2020
4efaaae
submission for joss
JustGlowing Jul 23, 2020
0e0b2fb
amend
JustGlowing Jul 23, 2020
bd449b0
pandoc fix
JustGlowing Jul 23, 2020
c6607a6
pandoc fix
JustGlowing Jul 23, 2020
cfa6000
bibliorphy fix
JustGlowing Jul 23, 2020
7e47bd0
bibtex fix
JustGlowing Jul 23, 2020
59f5910
paper refinements
JustGlowing Jul 23, 2020
d2aa2c1
bibtex ln fix
JustGlowing Jul 23, 2020
cc249ec
bibtex authors name fix
JustGlowing Jul 23, 2020
8235bf7
implemented suggestions
JustGlowing Jul 30, 2020
a22a3a2
implemented suggestions
JustGlowing Jul 30, 2020
4c892c4
Update Readme.md
JustGlowing Aug 1, 2020
1b08de6
Update Readme.md
JustGlowing Aug 1, 2020
7face01
Update Readme.md
JustGlowing Aug 14, 2020
4099e1d
Update Readme.md
JustGlowing Aug 16, 2020
8c4fd3b
Update Readme.md
JustGlowing Aug 19, 2020
c009692
fixed typo errors in readme
Sep 6, 2020
d81fca7
Merge pull request #81 from lazySperm/fix-typo-err-in-readme
JustGlowing Sep 6, 2020
7274561
Update Readme.md
JustGlowing Sep 6, 2020
b522d74
Update Readme.md
JustGlowing Oct 1, 2020
1e98172
warning
JustGlowing Oct 1, 2020
c4ef7c8
Update Readme.md
JustGlowing Oct 2, 2020
77e9757
Update Readme.md
JustGlowing Oct 3, 2020
70e2c5e
Update Readme.md
JustGlowing Oct 3, 2020
29f44f3
added return_indices parameter to win_map()
fgiobergia Oct 21, 2020
c8d4b00
minor fix
fgiobergia Oct 21, 2020
f909889
Merge pull request #85 from fgiobergia/win-map-indices
JustGlowing Oct 21, 2020
75edabd
Import bokeh libraries, add comments
avisionh Oct 26, 2020
9276d8f
Create interactive bokeh plot
avisionh Oct 26, 2020
5215201
Enable HTML document preview of bokeh plot
avisionh Oct 27, 2020
02c9e9e
release preparation
JustGlowing Nov 3, 2020
05e9656
Add markers to plot
avisionh Nov 3, 2020
ca4e19f
Merge pull request #88 from avisionh/example-hexagonaltopology-bokeh
JustGlowing Nov 4, 2020
5b92e5a
poems analysis scraper updated
JustGlowing Dec 7, 2020
defef93
poems analysis plot updated
JustGlowing Dec 7, 2020
4322c36
Update TimeSeries.ipynb
bijae Dec 18, 2020
a6a535f
Update PoemsAnalysis.ipynb
bijae Dec 18, 2020
668de3d
Update MovieCovers.ipynb
bijae Dec 18, 2020
7f250b3
Update HandwrittenDigits.ipynb
bijae Dec 18, 2020
edd7239
Update ColorSpaceMapping.ipynb
bijae Dec 18, 2020
8f9c9c9
Update BasicUsage.ipynb
bijae Dec 18, 2020
f3c9573
Update BasicUsage.ipynb
bijae Dec 27, 2020
417c052
Create AdvancedVisualization.ipynb
bijae Dec 27, 2020
f01f200
Merge pull request #91 from bijae/master
JustGlowing Jan 15, 2021
27abc21
Update Readme.md
JustGlowing Jan 18, 2021
5005a71
Update Readme.md
JustGlowing Jan 19, 2021
b90524c
hexa topo error and partitioned hexa errors for big data
ricardomourarpm Feb 23, 2021
12a9206
hexa topo error + partitioned hexa errors for big data + new example …
ricardomourarpm Feb 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,13 @@ nosetests.xml
.mr.developer.cfg
.project
.pydevproject

# Mac files
.DS_Store

# IDE config
.idea/

# Notebooks checkpoints
examples/.ipynb_checkpoints/

396 changes: 396 additions & 0 deletions New_HexagonalTopology.ipynb

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions README.md

This file was deleted.

328 changes: 328 additions & 0 deletions Readme.md

Large diffs are not rendered by default.

15,948 changes: 15,948 additions & 0 deletions examples/AdvancedVisualization.ipynb

Large diffs are not rendered by default.

323 changes: 323 additions & 0 deletions examples/BasicUsage.ipynb

Large diffs are not rendered by default.

122 changes: 122 additions & 0 deletions examples/Classification.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This examples show how to use MiniSom to solve a classification problem. The classification mechanism will be implemented with MiniSom and the evaluation will make use of sklearn.\n",
"\n",
"First, let's load a dataset (in this case the famous Iris dataset) and apply normalization:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"from minisom import MiniSom\n",
"import numpy as np\n",
"\n",
"data = np.genfromtxt('iris.csv', delimiter=',', usecols=(0, 1, 2, 3))\n",
"data = np.apply_along_axis(lambda x: x/np.linalg.norm(x), 1, data)\n",
"labels = np.genfromtxt('iris.csv', delimiter=',', usecols=(4), dtype=str)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Here's naive classification function that classifies a sample in `data` using the label assigned to the associated winning neuron. A label $c$ is associated to a neuron if the majority of samples mapped in that neuron have label $c$. The function will assign the most common label in the dataset in case that a sample is mapped to a neuron for which no class is assigned."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"def classify(som, data):\n",
" \"\"\"Classifies each sample in data in one of the classes definited\n",
" using the method labels_map.\n",
" Returns a list of the same length of data where the i-th element\n",
" is the class assigned to data[i].\n",
" \"\"\"\n",
" winmap = som.labels_map(X_train, y_train)\n",
" default_class = np.sum(list(winmap.values())).most_common()[0][0]\n",
" result = []\n",
" for d in data:\n",
" win_position = som.winner(d)\n",
" if win_position in winmap:\n",
" result.append(winmap[win_position].most_common()[0][0])\n",
" else:\n",
" result.append(default_class)\n",
" return result"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we can 1) split the data in train and test set, 2) train the som, 3) print the classification report that contains all the metrics to evaluate the results of the classification."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" precision recall f1-score support\n",
"\n",
" setosa 1.00 1.00 1.00 13\n",
" versicolor 0.92 1.00 0.96 12\n",
" virginica 1.00 0.92 0.96 13\n",
"\n",
" accuracy 0.97 38\n",
" macro avg 0.97 0.97 0.97 38\n",
"weighted avg 0.98 0.97 0.97 38\n",
"\n"
]
}
],
"source": [
"from sklearn.model_selection import train_test_split\n",
"from sklearn.metrics import classification_report\n",
"\n",
"X_train, X_test, y_train, y_test = train_test_split(data, labels, stratify=labels)\n",
"\n",
"som = MiniSom(7, 7, 4, sigma=3, learning_rate=0.5, \n",
" neighborhood_function='triangle', random_seed=10)\n",
"som.pca_weights_init(X_train)\n",
"som.train_random(X_train, 500, verbose=False)\n",
"\n",
"print(classification_report(y_test, classify(som, X_test)))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading