Skip to content

WIP : Self-Organizing Map - #39

Closed
scampion wants to merge 7 commits into
scikit-learn:masterfrom
scampion:master
Closed

scampion wants to merge 7 commits into
scikit-learn:masterfrom
scampion:master

Conversation

@scampion

Copy link
Copy Markdown

i added the SOM clustering (using a square grid in 2 dimensions) in my branch : https://github.com/scampion/scikit-learn

I also added the calinski_index mesure to evaluate clustering quality.

I don't know if i made a mistake but I'm a bit surprised by the comparaison between KMeans and SOM using digits dataset in example.

Self-Organizing Map done in 2.328s
calinski index 16.19 | 94.18%

KMeans done in 15.618s
calinski index 9.02 | 90.02%

Due to the SOM shape, i also use 16 clusters in the kmeans.
I don't know if my implemention is good or not.

At last, the unit test test_som.py produce a color map of the neurons as example.

@ogrisel

ogrisel commented Jan 11, 2011

Copy link
Copy Markdown
Member

Thank you very much for you contribution. I won't have time to review your code today but hope to do so soon enough. In the meantime, if other want to give it a look :)

@agramfort

Copy link
Copy Markdown
Member

it would also be good to add a reference to the paper. I still have to run the code. I just browsed it.

@fabianp

fabianp commented Jan 11, 2011

Copy link
Copy Markdown
Member

Hi Sebastian! Great to see you around, some quick comments:

  • As Alexandre, I'm a bit lost without some references :-)
  • Is there a reason why Kohonen2DMap's learn function is called 'learn' instead of 'fit'
  • Class SOM documents a data field that is not implemented
  • A name more explicit than w would be great for that parameter.
  • I suppose n_init is a typo and should be n_iter.
  • As Alexandre suggests, and since Kohonen2DMap is just referenced from SOM maybe both classes could be squashed ?

Thanks,

Fabian

…sing color and calinski function to measure clustering quality
@scampion

Copy link
Copy Markdown
Author

Thanks for yours remarks, i made corrections and recyle color map unit test as example using pylab.
I must check the reference

@agramfort

Copy link
Copy Markdown
Member

also it should be SelfOrganizingMap rather than SelfOrganisingMap

scampion and others added 2 commits January 13, 2011 09:47
merge SOM and Kohonen class, improve variable name, add and example using color and calinski function to measure clustering quality
@agramfort

Copy link
Copy Markdown
Member

here is a pull request for my code review

scampion#1

what is unclear to me is if this code can actually do clustering of more than 2D data.
If not the doc should be updated.

grep for XXX for my comments.

@GaelVaroquaux

Copy link
Copy Markdown
Member

In general this is looking very good. They are many places where you should add spaces after comas.

As Alex, I wonder: it seems to me that the code only works on features that are 2D images. Can you confirm this? This should be clearly indicated. Is there any chance that you could make the code work on 3D images as well as 1D datasets too by testing the size of the input data, and completing the shape of the array with empty dimensions to make it a 3D array, on which you could apply a generic 3D SOM code. It would make the module usable in much more general settings.

Finally, could you please add a small entry in the main documentation describing what SOMs are, giving a picture (generated from your examples) and links to the examples.

@agramfort

Copy link
Copy Markdown
Member

@seb: i'm wondering how your implementation compares with the one of pymvpa

http://www.pymvpa.org/examples/som.html

could you also answer when you have time to both gael's and my remarks (see above).

@MatthieuPerrot

Copy link
Copy Markdown

If i understand correctly, this implementation of SOM is restricted to square maps. In the general case, you need to define a topology (a graph) between your neurons. I think the class should be renamed accordingly.

@agramfort

Copy link
Copy Markdown
Member

unless someone has an objection I close this one

@agramfort agramfort closed this May 28, 2012
jnothman pushed a commit to jnothman/scikit-learn that referenced this pull request Nov 20, 2016
…spec-deprecated

MAINT: inspect.getfullargspec is deprecated in Py3.5
prismdata pushed a commit to prismdata/scikit-learn that referenced this pull request Oct 28, 2020
계림금속 PID 온도 제어기 매뉴얼
PSSF23 pushed a commit to PSSF23/scikit-learn-stream that referenced this pull request Aug 9, 2023
#### Reference Issues/PRs
Fixes README and wheel building


---------

Signed-off-by: Adam Li <[email protected]>
jeremiedbb added a commit to AnneBeyer/scikit-learn that referenced this pull request Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants