Giter Site home page Giter Site logo

som-toolbox's Introduction

SOM-Toolbox

A Matlab toolbox for Self-Organizing Maps (SOM) and others.

SOM Toolbox 2.0, a software library for Matlab 5 implementing the Self-Organizing Map algorithm is Copyright (C) 1999 by Esa Alhoniemi, Johan Himberg, Jukka Parviainen and Juha Vesanto.

SOM Toolbox 2.1 is a revision to the SOM Toolbox made in December 2012. See CHANGELOG for changes.

Setup

  1. Download
  2. addpath(genpath('SOM-Toolbox'));

This will add SOM-Toolbox and all subfolders into matlabpath.

Directories included in the toolbox

som/ - SOM functionality included in SOM Toolbox 2.0 (revised for this version)

gtm/ - GTM functionality eploiting Netlab GTM functions.

contrib/ - External contributions to SOM Toolbox

demo/ - Demo scripts

data/ - Data for demo scripts

dijkstra/ - Dijkstra algorithm from pmtk3 package (used by som_quality)

COPYRIGHT

This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.

Note: only part of the files distributed in the package belong to the SOM Toolbox. The package also contains contributed files, which may have their own copyright notices. If not, the GNU General Public License holds for them, too, but so that the author(s) of the file have the Copyright.

This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this package (file COPYING); if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

LICENSING THE LIBRARY FOR PROPRIETARY PROGRAMS

As stated in the GNU General Public License (see the license in COPYING) it is not possible to include this software library in a commercial proprietary program without written permission from the owners of the copyright.

som-toolbox's People

Contributors

agvallejo avatar david-pavlov avatar tvatanen avatar twocs avatar willfurnass avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

som-toolbox's Issues

Different accurency of the training data-how to handle it?

Hey,
I'm despratly needing help with one issue:
But I'm currently using this Toolbox for my masterthesis. The task of my masterthesis is to compare different accurate CO2 sensors for the ocean. Therefor I should creat a neural network and should find out which one is providing more accurate results. The idea is, that one sensor is less expensiv but has an accurancy of +- 5µatm and the other one is more expensiv and works with an accurancy of +-2µatm. I should now determine, if the neural network provids better results when I train it with the double the amount of unaccurate data. My biggest problem is, that I don't know where I can tell the neural network the accurancy of the data that it use to be trained. Maybe someone here knows a function which I need to use to tell MatLab about the accurancy of the Training data. If you know something to help me I would be very very glad!
I hope you understand my problem and can help me.

Floating point problem in som_seqtrain

Hi,
today I encountered a floating point problem in the som_seqtrain function. The if condition in line 407 was evaluated to true, but should be false.

I fixed the problem by using the proposed float-comparison method http://www.mathworks.com/matlabcentral/answers/97069-how-can-i-compare-numbers-for-equality-within-a-tolerance-in-matlab-8-0-r2012b

Replaced
if length(alpha) ~= trainlen
with
if ~(abs(length(alpha)-trainlen) < 1e4*eps(min(abs(length(alpha)),abs(trainlen))))

Encountered the problem with Matlab R2014a (Win10) and R2015b. Demo data and a script which causes the problem are attached.

example_error_som_seqtrain.zip

[Error! in setting labels] Length of 'labels' must be equal to the number of data vectors.

I am getting errors in:

sD = som_data_struct(D,'labels', labels, 'comp_names',headers);

and

sD = som_normalize(sD,'range'); % scale between 0 and 1

I assume it is because of how my data is organized: in row vectors.
The data is from the Global Events Database: GDELT.

Here's a few sample rows - it has 58 features in columns and few sample rows.

E.g. -
GLOBALEVENTID SQLDATE MonthYear Year FractionDate Actor1Code Actor1Name Actor1CountryCode Actor1KnownGroupCode Actor1EthnicCode Actor1Religion1Code Actor1Religion2Code Actor1Type1Code Actor1Type2Code Actor1Type3Code Actor2Code Actor2Name Actor2CountryCode Actor2KnownGroupCode Actor2EthnicCode Actor2Religion1Code Actor2Religion2Code Actor2Type1Code Actor2Type2Code Actor2Type3Code IsRootEvent EventCode EventBaseCode EventRootCode QuadClass GoldsteinScale NumMentions NumSources NumArticles AvgTone Actor1Geo_Type Actor1Geo_FullName Actor1Geo_CountryCode Actor1Geo_ADM1Code Actor1Geo_Lat Actor1Geo_Long Actor1Geo_FeatureID Actor2Geo_Type Actor2Geo_FullName Actor2Geo_CountryCode Actor2Geo_ADM1Code Actor2Geo_Lat Actor2Geo_Long Actor2Geo_FeatureID ActionGeo_Type ActionGeo_FullName ActionGeo_CountryCode ActionGeo_ADM1Code ActionGeo_Lat ActionGeo_Long ActionGeo_FeatureID DATEADDED SOURCEURL
440612069 20140613 201406 2014 2014.4466 AFR AFRICA AFR 0 36 36 3 1 4 2 1 2 4.945781539 0 1 South Africa SF SF -29 24 SF 1 South Africa SF SF -29 24 SF 20150613 http://www.thisdaylive.com/articles/precious-chikwendu-my-man-means-everything-to-me-i-ll-not-kiss-any-actor-romantically-in-a-movie/211846/
440612070 20140613 201406 2014 2014.4466 CAN ONTARIO CAN 1 30 30 3 1 4 56 7 56 -6.76019676 0 4 Lake Erie, Canada (general), Canada CA CA00 42 -81 -564290 4 Lake Erie, Canada (general), Canada CA CA00 42 -81 -564290 20150613 http://www.timesleaderonline.com/page/content.detail/id/866436/APNewsBreak--States-to-cut-pollutants-behind-Lake-Erie-algae.html?isap=1&nav=5019
440612071 20140613 201406 2014 2014.4466 CVL NEIGHBORHOOD CVL 1 46 46 4 1 7 10 1 10 0.149700599 0 3 Phoenix, Arizona, United States US USAZ 33.4484 -112.074 44784 3 Phoenix, Arizona, United States US USAZ 33.4484 -112.074 44784 20150613 http://www.azcentral.com/story/news/local/chandler/2015/06/12/older-buildings-chandler-floats-idea/71151120/
440612072 20140613 201406 2014 2014.4466 EDU SCHOOL EDU 1 36 36 3 1 4 5 1 5 -2.413793103 0 3 Chicago, Illinois, United States US USIL 41.85 -87.6501 423587 3 Chicago, Illinois, United States US USIL 41.85 -87.6501 423587 20150613 http://www.uexpress.com/sense-and-sensitivity/2015/6/12/reader-dreads-brother-moving-in-with
[Error! in setting labels] Length of 'labels' must be equal to the number of data vectors.
[Error! in setting comp_names] Length of 'comp_names' should be equal to dim.
Attempted to access p(1); index out of bounds because numel(p)=0.

Error in som_norm_variable>norm_scale_do (line 357)
x = (x - p(1)) / p(2);

Error in som_norm_variable (line 299)
case 'range', x = norm_scale_do(x,sNorm(i).params);

Error in som_normalize (line 294)
[x,sN] = som_norm_variable(D(:,i), csNorm{i}, 'do');

Error in SOTM (line 18)
sD = som_normalize(sD,'range'); % scale between 0 and 1

Som toolbox demo4

hi,
Please help me regarding Som toolbox demo4 code.I am getting this error.If anyone has code for water quality using SOM.Please email me @[email protected].
Thank you
Reply as soon as possible
Capture

Trying to run som_demo1 under Matlab 2013a

I have cloned the repo, added the path to the environment and tryed

run('SOM-Toolbox/demo/som_demo1')

unfortunately this error pops up.

% ==========================================================
% SOM_DEMO1 - BEHAVIOUR AND PROPERTIES OF SOM
% ==========================================================
% som_make - Create, initialize and train a SOM.
% som_randinit - Create and initialize a SOM.
% som_lininit - Create and initialize a SOM.
% som_seqtrain - Train a SOM.
% som_batchtrain - Train a SOM.
% som_bmus - Find best-matching units (BMUs).
% som_quality - Measure quality of SOM.
% SELF-ORGANIZING MAP (SOM):
% A self-organized map (SOM) is a "map" of the training data,
% dense where there is a lot of data and thin where the data
% density is low.
% The map constitutes of neurons located on a regular map grid.
% The lattice of the grid can be either hexagonal or rectangular.
subplot(1,2,1)
som_cplane('hexa',[10 15],'none')
Undefined function 'som_cplane' for input arguments of type 'char'.

Error in som_demo1 (line 38)
som_cplane('hexa',[10 15],'none')

Error in run (line 64)
evalin('caller', [script ';']);

Problem

I tried to build the SOM for the data set of 26 samples of 5 variables each (26 x 5).
If I test the msize=[9 6], everything looks OK (see Figure)

som_9x6

But, when I change the size, for example msize = [9 9], than some data go outside the SOM (see Figure below)
som_9x9

Similar results I observed, using the example of clustering the metals which are given in the SOM Toolbox manual. If I change msize, some points go outside the SOM.

Does anybody know, where is the problem?
Best regards,
Jan

Parallelize SOM-Toolbox

Hi everyone:

There is a way to parallelize the som_make or som_batchtrain functions? I want to speed up this functions but I don't have the Parallel Computing Toolbox.

Binary input data

I was wondering how to deal with binary coded input data, when other distance measurement metrics than Euclidean are necessary. Are there any functions supporting e.g. Hamming or Jaccard distance metrics? or: Where can I specify those?

I look forward to receiving any response to decide if I should further use it for my project
Thanks for your support (i am a SOM newbie...forgive me)!

getting error in gtm script..

net = gtm_make(sD(cv.training(j),:), 'rbfgrid', [6 6], 'regul', alphas(i));
can anyone try to run gtm scripts and help me out from this.
Thanks

Problem running som_demo2

Hi,

I start woking with SOM, in order to know what the toolbox is capable to do, I'm running the demo scrpits, using Matlab R2015a. When I was running the second demo, the program stops in the fourth step, and show the message:

image

actually I'm not very good using Matlab, but so I thought I can deal with the error changing some variables names, but didn't work.

I appreciate if someone can help me with this

Allow component plane titles to optionally be interpreted as LaTeX

Noticed the following in som/som_show.m:

% Set text property 'interp' to 'none' in title texts

set(h_label,'interpreter','none');

Would be nice if could switch between standard text interpretation and LaTeX interpretation for component subplot titles. Made a start on this here but having problems with keyword argument parsing - any pointers gratefully received.

problem with som_stats

Hi,

When I use som_stats to get statistics across clusters, it returns NaN for some clusters, although there are hits in those clusters and would be good to have numbers for them.
Attached is an example with Iris data.
capture
capture1

I tried to correct som_stats by changing row 174 into
if nargin<2 || isempty(bins) || sum(isnan(bins))>0,
but it does not help.

would appreciate your help with that.

error running the demo

Hi, I get the following error when running som_demo4.m

som_show(sM,'umat','all','comp',[1:4],'empty','Labels','norm','d');
Cannot convert double value -1 to a handle

I am using Matlab R2015b on Ubuntu.

Any suggestions would be much appreciated.

Michel

How to handling lots of columns of input data for som training

Recently, I want to construct a som model using somtoolbox in matlab. I have 350 SST (sea surface temperature) images. Each image is 400 pixels by 480 pixels. And each SST image was transformed into a single row vector by concatenating image rows. So that the input matrix consisted of 350 rows (image) and 192000 columns (pixels). But when I run the following code,some errors occured. Could you please tell me how to solve this problem? Thanks for your consideration.

`clc;clear;
%prepare your data (satellite remote sensing data)
myFiles=dir('D:/MatlabTemp/SSC/.tif');
fileLength=length(myFiles);
myMatrix=[];
firstRaster=imread('D:/MatlabTemp/SSC/m20030530.tif');
[m,n]=size(firstRaster);
for i=1:(fileLength)
filename=myFiles(i).name;
path='D:\MatlabTemp\SSC';
imgPath=strcat(path,'',filename);
raster=imread(imgPath);
vector=reshape(raster,1,m
n);
myMatrix=[myMatrix;vector];
end

%TSM data n * m (n samples(image)) m (pixels)
myMatrix(isnan(myMatrix)) = -1;

%inialize parameters of som algorithm
msize = [3 4];
init = 'lin';
train = 'batch';
neigh = 'ep';
rad = [5 1];

y = myMatrix;

%construct the input data used for som algorithm
sD = som_data_struct(y);

if strcmp(init,'rand')
sM = som_randinit(sD,'msize',msize);
elseif strcmp(init,'lin')
sM = som_lininit(sD,'msize',msize,'lattice','rect','shape','sheet');
end
%train som algorithm
if strcmp(train,'batch')
sM = som_batchtrain(sM, sD,'radius',rad,'trainlen',1000,'alpha_type','inv','neigh',neigh);
elseif strcmp(train,'seq')
sM = som_seqtrain(sM, sD,'radius',rad,'trainlen',1000,'neigh',neigh);
elseif strcmp(train,'sompak')
sM = som_sompaktrain(sM,sD,'radius',rad,'trainlen',1000,'neigh',neigh,'alpha_type','inv');
end`

Error using zeros

Requested 192000×192000 (274.7GB)array exceeds maximum array preference.Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information.

Error in som_liminit(line 222)
A = zeros(dim);

som_show and Matlab R2014b: Cannot convert double value -1 to a handle

When trying to run som_demo2 in Matlab R2014b I get the following:

som_show(sMap,'umat','all','empty','Labels')
Cannot convert double value -1 to a handle

Error in som_show (line 496)
    h_colorbar(i,1)=-1;

Error in som_demo2 (line 259)
som_show(sMap,'umat','all','empty','Labels')

Can this be fixed by commenting out h_colorbar(i,1)=-1; in som_show.m or skipping this line if verLessThan('matlab', '8.4')?

why som_show_add label not show all labels?

image

I am a som newbie.
I have a total of 85 data.
Their labels are from 1 to 85, but only a part of them are shown in the figure.
Where are the other labels and how to display them?
Thanks !

SOM component plots and MATLAB 2014b: subplot spacing after resizing figure

In MATLAB 2014a component plane subplots are resized when the figure window is resized. This does not happen on 2014b: the subplot spacing increases when one maximises the figure windows but the subplot size does not (which can make the subplots very difficult to interpret if one is trying to view a large number of component planes).

A workaround is to specify a large figure size when the figure is created:

    if strcmp(version('-release'), '2014b')
        % A bug in the SOM toolbox prevents subplots from
        % dynamically resizing when the window size is increased
        % so create a maximised figure by default
        figure('units', 'normalized', 'outerposition', [0 0 1 1]);
    else
        figure();

Select hits from SOM, "som_select"

I am trying to get a selection of hits from som map, for this object I use "som_select" function. However, I can't get GUI, i get the next answer:

I am trying to get a selection of hits from SOM map, for this object I use "som_select" function. However, I can't get GUI, I get the next answer:

som_select(150);
??? Error using ==> getfield at 31
Not enough input arguments.
Error in ==> som_select>draw_colorselection at 354
for i=0:getfield(size(rep_y,2))-1, rep_x(:,i+1)=rep_x(:,i+1)+i; end
Error in ==> som_select at 153
draw_colorselection(c_names,c_colors);

I have used SOM struct, initial dataset, size of SOM struct, size of initial datasets…but these aren’t successful input arguments…

Somebody know other way to select hits of my SOM, an example o turorial to practice?

thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.