SOM (Self-organizing map) code in matlab

Please visit my page to download complete code and training dataset.
https://sites.google.com/view/chi3x10/home

 

Below is the code of applying SOM on handwritten digits recongnition. It was implemented for a homework assignment in a course offered by professor Paul Gader. I used only ten handwritten digits images provided by Dr. Gader. Each image is resized to 30×30 and reshape to a 900×1 column vector. data in the code below is the training set. It’s a coolection of 900-dimensional column vectors.

%//Matlab script
%//-- 10 x 10 map

data = double(data);
%// toal number of nodes
totalW = 100;
%//initialization of weights
w = rand(900, totalW);
%// the initial learning rate
eta0 = 0.1;
%// the current learning rate (updated every epoch)
etaN = eta0;
%// the constant for calculating learning rate
tau2 = 1000;

%//map index
[I,J] = ind2sub([10, 10], 1:100);

N = size(data,2);

alpha = 0.5;
%// the size of neighbor
sig0 = 200;

sigN = sig0;
%// tau 1 for updateing sigma
tau1 = 1000/log(sigN);

%i is number of epoch
for i=1:2000
    %// j is index of each image.
    %// it should iterate through data in a random order rewrite!!
    for j=1:N
        x = data(:,j);
        dist = sum( sqrt((w - repmat(x,1,totalW)).^2),1);

        %// find the winner
        [v ind] = min(dist);
        %// the 2-D index
        ri = [I(ind), J(ind)];

        %// distance between this node and the winner node.
        dist = 1/(sqrt(2*pi)*sigN).*exp( sum(( ([I( : ), J( : )] - repmat(ri, totalW,1)) .^2) ,2)/(-2*sigN)) * etaN;

        %// updating weights
        for rr = 1:100
            w(:,rr) = w(:,rr) + dist(rr).*( x - w(:,rr));
        end
    end

    %// update learning rate
    etaN = eta0 * exp(-i/tau2);
    %// update sigma
    %sigN = sigN/2;
    sigN = sig0*exp(-i/tau1);

    %//show the weights every 100 epoch
    if mod(i,200) == 1
        figure;
        axis off;
        hold on;
        for l = 1:100
            [lr lc] = ind2sub([10, 10], l);
            subplot(10,10,l);
            axis off;
            imagesc(reshape(w(:,l),30,30));
            axis off;
        end
        hold off;
    end
end

Result:
See the transition between different numbers? 🙂
SOM

130 Responses to SOM (Self-organizing map) code in matlab

  1. Paul says:

    it is wonderfull.thank u.But do u have linear vector quantization(lvq) algortihm with solving any problem in matlab code, if u could u send me pls??? Cause i need it urgently.Thank u a lot…Have a nice day.

  2. Paul says:

    😦 there is no reply

  3. chi3x10 says:

    Paul,
    Sorry I have never implemented any linear vector quantization algorithm. Is k-means only of the way to do it? If yes, use the matlab built-in function kmeans(…).

    Jason

  4. Paul says:

    thank u very much for your replying.but k-means algorithm and lvq are different wth each other.Up to me there is no relationship btwn them.i search in the internet but i did not get any code.how can i do? can u advise me pls???

  5. Paul says:

    thanx a lot but i need code in matlab 😦 by the way i do not know anything about matlab programming language.i know C,Java,ASP…etc but ı never seen matlab and i need the code about lvq…

  6. Jack says:

    Please can you send me the matlab code for SOM.This code does not work.Please help me:(In the fourth line there occurs a data problem

  7. chi3x10 says:

    Jack,
    “data” is a 2d array contains collection of column vectors that you want to train your SOM.

  8. Jack says:

    can you give me an example?

  9. Mak says:

    chi3x10 Says: , can u add me on MSN, l_h_mak@hotmail.com, i need your guide on SOM, Pls ..

  10. chi3x10 says:

    Mak,

    Post your questions here. I am sure we can solve the problems here.

  11. archana says:

    kmeans code in matlab does not work.can u help me in finding out the correct code

  12. suaracahaya says:

    gonna try this out…
    thanks!
    oh ya, how do I make the train data?

  13. chi3x10 says:

    each training data is a column vector stored in “data”. data is a of size 900xN where N is the number of training data you have. If you have data with dimensionality other than 900, you need to modify the code a little bit.

  14. Ssunaaa says:

    Thanks!
    Why there is “1/sqrt(2*pi*sigN)” to calculate distance from the winnner?
    I thought ‘distance = learning rate * neighborhood function’.
    any reason???

  15. chi3x10 says:

    1/sqrt(2*pi*sigN) is the normalization factor.

  16. abirami balasubramaniyan says:

    sir,it is nice and easy in understanding.Do u hav any sample code for the background subtraction by using som

  17. flashfs says:

    chi3x10,
    I read that you prefer answering questions here, not by messenger or email, am I right? First of all, thank you for making your code public. Abusing of your kindness, I have some doubts about SOM. I’ll make one for now. Can you say to me when to use unidimensional or bidimensional maps? Why use one of them.

    Just for observation, I’m using Octave in Linux (similar to Matlab).

    Sorry for any English mistakes, I’m brazilian.

  18. chi3x10 says:

    flashfs,

    It depends on the topological property of the data in original feature space. My code here is 2D.

    Jason

  19. flashfs says:

    chi3x10,

    Can you tell me one example of a set of data that it would be good to use a unidimensional map?

  20. luuk says:

    chi3x10,

    thanks for sahring your code!

    I’m not familiar with SOM conventions, but distance seems to be related to INVERSE
    distance (higher when nearer), correct?

    (Seems to make sense, since weight update is heavier when nearer then)

    Also, having this map now how do you classify a new input vector? I assume: find nearest node. Correct, or is there a fancier method?

    Cheers,
    Luuk

  21. flashfs says:

    At line 35, are you sure it is sum(sqrt(…)) and not sqrt(sum(…))?

  22. whytv says:

    what exactly is a 10 x 10 map?

    and are you sure the line:
    dist = 1/sqrt(2*pi*sigN).*exp( sum(( ([I(:), J(:)] – repmat(ri, totalW,1)) .^2) ,2)/(-2*sigN)) * etaN;
    is correct? shouldn’t sigN be squared?

  23. chi3x10 says:

    It’s a two dimensional map consist of 10×10 output nodes. See the attached image which shows the weights of the 10×10 nodes.

    You are right! I modified the equation to
    dist = 1/(sqrt(2*pi)*sigN).*exp( sum(( ([I(:), J(:)] – repmat(ri, totalW,1)) .^2) ,2)/(-2*sigN)) * etaN;
    Thanks for pointing out the mistake!

  24. manji says:

    Sir, please send me matlab coding of Kohonen network including each step of Self-organizing map.

  25. claus says:

    nice job!
    thanks to chi3x10.
    I’ll stay tuned.
    bye.

  26. vikas anand says:

    can you tell me how I can use this program for clustering of data.
    .

  27. vikas anand says:

    HI Chi,
    I am trying to do clustering/ classification of a multidimentional data using SOM. I am new to SOM, and would really appreciate your help. The code you have uploaded is running but can you provide any of your papers or a book or notes from where you have laid the mathematics in the code. There are certain points like updating of sigma, learning rate, for which I am not able to find any equations similar to what is in the code. Also if possible please tell me how you came up with inital learning rate, constant of learning rate and size of the neighbour. I really look forward to hearing back from you. Thanks

    You can reply me at vcoolboys@yahoo.com or here as per your convinience.
    regards,
    vikas

  28. Rosa says:

    Hi

    I can’t understand this line:
    dist = 1/(sqrt(2*pi)*sigN).*exp( sum(( ([I( , J( ] – repmat(ri, totalW,1)) .^2) ,2)/(-2*sigN)) * etaN;

    what is the smile icon?
    I couldn’t run the code because of the following error:
    ??? Error: File: somm.m Line: 43 Column: 53
    Unexpected MATLAB operator.

    • chi3x10 says:

      It should be
      # dist = 1/(sqrt(2*pi)*sigN).*exp( sum(( ([I( : ), J( : )] – repmat(ri, totalW,1)) .^2) ,2)/(-2*sigN)) * etaN;

      wordpress automatically convert ( : ) to a ( and a smiley face.

  29. beheshteh says:

    hi
    i need help for this question:
    As a very simple system of watermarking we want to hide a W × H gray–scale image, G,
    in a W×H color image, I. The proposed method is to quantize G to 6 bpp and I to 3×6 bpp
    (6 bit for each channel). Now G can easily be hidden in I. Develop code to hide and
    extract the given G in the given I.

    i do not know anything about matlab programming language.i need help for do it
    please help me if u can as soon as u can:)

  30. dragos&andrei says:

    sa-ti traiasca familia!!!

  31. butterfly says:

    i try run the code,
    but it can’t be accomplished..

    it prints the error
    “data are uninitialised”..
    how can i fix this error?
    tq

  32. Hema says:

    Hi thanx for the code

    How to I cluster multidimensional data?

    Is it possible with the above code?

    what do I have to modify?

    Thank you

  33. chi3x10 says:

    Hema,
    The code is of course for multidimensional data.

  34. غربية says:

    thanks for this code
    but where are data to be use

  35. kh says:

    hi chi3

    can the code run for input vector

    29 * 16 matrix?

  36. chi3x10 says:

    Hi, kh,

    Yes, it can but you have to modify the code a little bit.

  37. G says:

    Thanks for this code. It was very useful to me.

  38. suneeta says:

    Can you please provide me the code in matlab for SOM clustering for detection of IP Spoofing

  39. ghada says:

    can you please provide me the code in matlab for multi som or generilzation of som

  40. elaheh says:

    hi thanks very much plz send me your dataset
    i want to know has it any problem that i use your code for my homework.

    thank very much

  41. hanan says:

    thanks alot

    i want matlab code for self organizing graph
    i want to use som in graph layout based on a competitive learning algorithm

  42. donald says:

    Thank you for this code, would you please give me your data ,I am new in matlab

  43. Laxmi says:

    can u provide me som progarm for training n testing of huge dataset.As i have already go though the above mentioned program but why alpha has taken as 0.5.As firther it has no use atall…plz do reply me…

  44. Laxmi says:

    plz do give me som progarm for training n testing of huge dataset.As i have already go though the above mentioned program but why alpha has taken as 0.5.As further it has no use atall…plz do reply me…

  45. Iman says:

    Dear chi3x10,

    Thank you for the code and your help in answering the questions.

    I have a cube of uniformally distributed samples of size (12,25,50) equivalent (Z,Y,X).
    So you can think of it as 12 maps/slices that are stacked.

    I want to organize the maps by SOM to show different clusters for each map.

    I know that SOM uses two process:
    in the ‘Taining’ stage (where a sample from the input data is randomly selected), but in your code you are using all the data not samples, right?

    Where do you separate between the ‘Training’ stage and the ‘Application’ stage?

    Giving the size of my data (cube of size (12, 25, 50)),What will be good numbers for: # of Epoch,and # of Randomly selected input?

    Please reply to my questions.. Thanks.

  46. Indra says:

    Hi chi3×10,
    excellent post!
    have u any link where i can find the data trainning set that u use?

    Thanx a lot

  47. Iman says:

    Can you please answer my questions?

  48. iamyouareheis says:

    Add me to coyotus1@hotmail.com I can help you with the data train set.

  49. starry says:

    hi i am doing “adaptive noise cancellation using enhanced dynamic fuzzy neural mnetworks IEEE 2005 paper”
    plz help me to develop “dynamic fuzzy neural network”
    using matlab.

  50. Jess says:

    Can you please teach me on how to use the training neaural network using SOM…….Can you send me the procedures that can be done on testing the trained neural network….

  51. Jess says:

    Can you send me a codes on how to test the data after training…. I really dont know how to use the training data net on testing another data as input. .. I can only trained it but i dont really know how to test it.

  52. Bari says:

    Hi
    I need the Self Organing map program in Matalab so I can use it for extracting trace from seismic 3D did some one have an idea where I can find that type of program

  53. Bari says:

    Can you send me SOM code in matlab please I need your help.

  54. ehsan says:

    hi,i am doing artical(inhanced self organization incremental neural network for unsupervice learning)
    please help me to code using matlab.

  55. ehsan says:

    hi, can you me ESOINN OR ESOM code in matlab please i need your help.tank.

  56. Shweta says:

    I m doing a project titled “Content Based Video Retrieval Using Fuzzzy Logic”. Can u plz send me the matlab code? Thank you.

  57. gopal says:

    how to provide input to this SOM?

  58. bhomik says:

    the code that is given is running but i am unable to understand what output is shown in figures (how the data is classified).plz.. help me its urgent…

  59. lavanya says:

    sir,
    pls may i know the code to classify normal and abnormal images using SOM.

  60. subra says:

    hi, can u give me some of ur pulished papers so that i can go through, ur code looks quitehelpful, at the same time, if u have sample cada it would be quite help ful, thank u, by the way how many output clusters does it have.

    • alfarezell says:

      hi…i’m trouble using your code…the problem is

      ??? Error using ==> minus Matrix dimensions must agree. Error in ==> som at 37 dist = sum( sqrt((w – repmat(x,1,totalW)).^2),1);

      can u help me…thanks

  61. ALI says:

    IS THERE ANY BODY WHO TELL ME HOW I SOLVE THIS ERROR

    ??? Error using ==> times
    Matrix dimensions must agree.

    Error in ==> som at 116
    weights = weights(:,rr) + dist().*( x – weights(:,rr));

  62. ALI says:

    sorry the error is like that not above one

    ??? Attempted to access weights(:,2); index out of bounds because
    size(weights)=[32,1].

    Error in ==> som at 116
    weights = weights(:,rr) + dist(rr).*( x – weights(:,rr));

  63. dhifaf says:

    i give data as 10*10 matrix but i got this error,how can i solve thi error?

    ??? Error using ==> minus
    Matrix dimensions must agree.

    Error in ==> Untitled at 38
    dist = sum( sqrt((w – repmat(x,1,

  64. John says:

    Hello!!!!!
    I am new in machine learning and i am trying to implement a SVM with SOM ,the code above is very intresting and i want to use it in whole MNIST base and
    take error results and training time

    I need help please!!!!!!!!!
    Thanks in advance!!

  65. John says:

    Please help me I dont have mutch time!!!

  66. John says:

    Is my school project!!!

  67. John says:

    Hi,
    I am new in machine learning and I am trying to implement a SVM with SOM so I want to do this for whole MNIST(train and test) and take error result(plot)…

    Please help me
    Thanks in advance!!!

  68. alfarezell says:

    hi…i’m trouble using your code..

    ??? Error using ==> minus Matrix dimensions must agree. Error in ==> som at 37 dist = sum( sqrt((w – repmat(x,1,totalW)).^2),1);

    can u help me please…thank u

  69. sid says:

    hi,
    could you just help me in finding out the code related to “Dynamic Hierechial SOM”
    thanx

  70. sid says:

    hi,
    could you just help me in finding out the code related to “Dynamic adaptive SOM”
    thanx

  71. sindu says:

    hi .. i need to implement som for brain yumor detection.. can u plz explain d code for this pseudo code??
    Procedure seg (image)
    /* load the input image*/
    Im = imread(image);
    /* initialize the variable*/
    Sigma=number of neighborhood pixels(8 or 24 or 48 or 80 or 120)
    /*if sliding windoe size(3*3 =8),(5*5=24),(7*7=48),)(9*9=80),(11*11=120)*/
    Sigma N= Sigma 0 * exp(-i/taul)
    Taul= total number of pixels / log(neighborhood number of pixel)
    /*Similarly find the sigma value for each and every pixel */
    /* find the neighborhood function */
    Nf(i)=Img(i)-img(i+1)*sigma(i)
    /*find the weight vector*/
    Wi(i+1)=wi+Nf(i)*img(i)-w(i)
    /*find the winning neuron*/
    Wn=max(wn,img(i)-w(img(i))
    /* segmentation of som*/
    Img(i)>=wn then
    img(i)=1
    Else
    Img(i)=img(i)

  72. sindu says:

    plz anyone help me out wit Sigma N…

  73. Bari says:

    thanks for these code it will help

  74. poonam says:

    plz anyone help me out wid determinstic sigmoid belief network.

  75. Babita says:

    hi .. i need to implement codebook using som from vector quantized coefficients of images for image compression.. ?
    could you just help me in finding out the code for the same?

  76. pj says:

    WHERE IS DATA…?

  77. Hamza Rehman says:

    hi .. i need to implement som for brain yumor detection.. can u plz explain d code for this pseudo code??
    Procedurnt e seg (image)
    /* load the input image*/
    Im = imread(image);
    /* initialize the variable*/
    Sigma=number of neighborhood pixels(8 or 24 or 48 or 80 or 120)
    /*if sliding windoe size(3*3 =8),(5*5=24),(7*7=48),)(9*9=80),(11*11=120)*/
    Sigma N= Sigma 0 * exp(-i/taul)
    Taul= total number of pixels / log(neighborhood number of pixel)
    /*Similarly find the sigma value for each and every pixel */
    /* find the neighborhood function */
    Nf(i)=Img(i)-img(i+1)*sigma(i)
    /*find the weight vector*/
    Wi(i+1)=wi+Nf(i)*img(i)-w(i)
    /*find the winning neuron*/
    Wn=max(wn,img(i)-w(img(i))
    /* segmentation of som*/
    Img(i)>=wn then
    img(i)=1
    Else
    Img(i)=img(i)

    plz plz help me out if you cannnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
    give me hint about neighbour hood function

  78. IMen says:

    please I don’t get wht’s Data here in this code

    • dfdfd says:

      this is brain tumor detection code which is given in a reaseach paper by karan namely as ‘AN improved imoplementation of brain tumour detection ‘ PLZ for GOD sake any one help me

  79. adisis says:

    what is diff between dist@line 35 and dist@line 43

  80. Ali says:

    Hi every body, please if any body have SOM code in matlab for skin segmentation inform.thank you.

  81. annette says:

    Hi…. Im doing unsupervised remote sensing change detection… (o/p will be binary map) Plz can anyone help me to code using matlab

  82. Sourav Paul says:

    I want 2 segment the image using SOM,If any one have any source code in matlab please send me.

  83. Aditi says:

    Hi,
    I have a multi dimensional input(5), and I want to use the program to cluster the data, based upon the class(I know the class). I was able to do the clustering part, but my problem now is to map that data clusters into 2-D neuron grid, and see if actually neurons are clustered. In the above code I changed 900 to 5 etc. But I need help in plotting. I know images(…) doesnt work for me. Any idea anyone? (P.S I have also made little changes in the program to list all the winning neurons in case of each input.. I have 1000 input data values).

  84. puritan says:

    it worked for me…had to change it a little bit…
    but hey, thanks for the help …it helped a lot..
    keep up the good work.

  85. A S says:

    Good code but What present code indicate?

    Kindly clarify how this data is sent to training as we are not updating ‘data’. As your code able to find transitions, how it could give different labels to data? Thanks is advance.

  86. AAR says:

    %// distance from the winnner
    dist = 1/(sqrt(2*pi)*sigN).*exp( sum(( ([I( : ), J( : )] – repmat(ri, totalW,1)) .^2) ,2)/(-2*sigN)) * etaN;
    Kindly make this line discernible. What these lines stand for? What does the “distance from the winner” mean here?

  87. kanaga says:

    hai,
    i need self organizing map(som) matlab code for classification of remote sensing images….please help me…please reply to may mail id…thank you

  88. MB says:

    Hi Guys

    I need to run self organize map on seismic volume for classification for diffrent attributes but I want the result to be in 3D volume instead of 2D view did nybody has a code for that?

  89. saara says:

    Hi, i need matlab code to train the som neural network. Please send me…

  90. momo says:

    hello
    i cannot run this code.’data ‘is the problem.anybody help me to run this program?
    my id momotaz.2k3@gmail.com

  91. Shweta says:

    Why do you choose a 10×10 matrix?

  92. Ahaa, its nice discussion concerning this post at this place at this webpage, I have read all that,
    so at this time me also commenting here.

  93. rohit says:

    hi paul
    myself rohit jain. i have to find mean square error by som. can you u help me by giving me a matlab code for it.
    please reply me on maxi2623@gmail.com

  94. z.r says:

    Hi
    This is for segmentation
    clc
    clear all
    %//Matlab script

    %data = double(data);
    data=imread(‘test.jpg’);
    [r,c]=size(data);
    new_r=r*c;
    data = reshape(data,new_r,1);
    %// toal number of nodes
    r_map=2;
    c_map=6;
    Total_node=r_map*c_map;

    totalW = Total_node;
    %//initialization of weights

    max_value=max(data);

    w = rand(new_r, totalW);

    %// the initial learning rate
    eta0 = 0.1;

    %// the current learning rate (updated every epoch)
    etaN = eta0;

    %// the constant for calculating learning rate
    tau2 = 1000;

    %//map index
    [I,J] = ind2sub([r_map, c_map], 1:Total_node);

    N = size(data,2);

    alpha = 0.5;
    %// the size of neighbor
    sig0 = 200;

    sigN = sig0;
    %// tau 1 for updateing sigma
    tau1 = 1000/log(sigN);

    %i is number of epoch
    for i=1:1000
    %// j is index of each image.
    %// it should iterate through data in a random order rewrite!!
    for j=1:N
    x = double(data(:,j));

    %d=sqrt(sum(abs(w_final-repmat(r1,row2,1)).^2,2));
    dist = sum( sqrt((w – repmat(x,1,totalW)).^2),1);

    %// find the winner
    [v ind] = min(dist);
    %// the 2-D index
    ri = [I(ind), J(ind)];

    %// distance between this node and the winner node.
    dist = 1/(sqrt(2*pi)*sigN).*exp( sum(( ([I( : ), J( : )] – repmat(ri, totalW,1)) .^2) ,2)/(-2*sigN)) * etaN;

    %// updating weights
    for rr = 1:Total_node
    w(:,rr) = w(:,rr) + dist(rr).*( x – w(:,rr));
    end
    end

    %// update learning rate
    etaN = eta0 * exp(-i/tau2);
    %// update sigma
    %sigN = sigN/2;
    sigN = sig0*exp(-i/tau1);

    %//show the weights every 100 epoch
    if mod(i,200) == 1
    figure;
    axis off;
    hold on;
    for l = 1:Total_node
    [lr lc] = ind2sub([r_map, c_map], l);
    subplot(r_map,c_map,l);
    axis off;
    imagesc(reshape(w(:,l),r,c));
    axis off;
    end
    hold off;
    end
    end

    clc
    clear all
    %//Matlab script

    %data = double(data);
    data=imread(‘test.jpg’);
    [r,c]=size(data);
    new_r=r*c;
    data = reshape(data,new_r,1);
    %// toal number of nodes
    r_map=2;
    c_map=6;
    Total_node=r_map*c_map;

    totalW = Total_node;
    %//initialization of weights

    max_value=max(data);

    w = rand(new_r, totalW);

    %// the initial learning rate
    eta0 = 0.1;

    %// the current learning rate (updated every epoch)
    etaN = eta0;

    %// the constant for calculating learning rate
    tau2 = 1000;

    %//map index
    [I,J] = ind2sub([r_map, c_map], 1:Total_node);

    N = size(data,2);

    alpha = 0.5;
    %// the size of neighbor
    sig0 = 200;

    sigN = sig0;
    %// tau 1 for updateing sigma
    tau1 = 1000/log(sigN);

    %i is number of epoch
    for i=1:1000
    %// j is index of each image.
    %// it should iterate through data in a random order rewrite!!
    for j=1:N
    x = double(data(:,j));

    %d=sqrt(sum(abs(w_final-repmat(r1,row2,1)).^2,2));
    dist = sum( sqrt((w – repmat(x,1,totalW)).^2),1);

    %// find the winner
    [v ind] = min(dist);
    %// the 2-D index
    ri = [I(ind), J(ind)];

    %// distance between this node and the winner node.
    dist = 1/(sqrt(2*pi)*sigN).*exp( sum(( ([I( : ), J( : )] – repmat(ri, totalW,1)) .^2) ,2)/(-2*sigN)) * etaN;

    %// updating weights
    for rr = 1:Total_node
    w(:,rr) = w(:,rr) + dist(rr).*( x – w(:,rr));
    end
    end

    %// update learning rate
    etaN = eta0 * exp(-i/tau2);
    %// update sigma
    %sigN = sigN/2;
    sigN = sig0*exp(-i/tau1);

    %//show the weights every 100 epoch
    if mod(i,200) == 1
    figure;
    axis off;
    hold on;
    for l = 1:Total_node
    [lr lc] = ind2sub([r_map, c_map], l);
    subplot(r_map,c_map,l);
    axis off;
    imagesc(reshape(w(:,l),r,c));
    axis off;
    end
    hold off;
    end
    end

    • thaa says:

      hi, thanx for ur code it works so well, now my problem is finding the index it’s giving me wrong values

  95. Alireza says:

    hi chi3x10
    i used your code and for reading data :

    data=imread(3.jpg)

    but the error showed:

    ??? Error using ==> minus
    Matrix dimensions must agree.

    Error in ==> digits at 35
    dist = sum( sqrt((w –
    repmat(x,1,totalW)).^2),1);

    can you help me ?

  96. Abdul Hadi says:

    hello, i want to ask u about the code. do u know the coding for imputation of missing data problem

  97. siva says:

    hi pls tell how to segment the web page using som algorithm . i need solution soon please update need source code yaar.

  98. hi paul,
    I Apriyanto, I need a code to determine the threshold value of the SOM algorithm

    please reply to email: 192apriyanto.jr @ gmail.com
    Thank you …

  99. donya says:

    hi , i need a data set to impelementation of SOM or WebSOM, please help me and send me a data set .tnx

  100. Hi Jason,

    May I know why you have the term “1/(sqrt(2*pi)*sigN)” in the weights update equation. I believe your lecturer was following NN by Simon Haykins, and so couldn’t fit it into the descriptions in the book.

    W = W + N(n) h(n) * (x – W)

    N(n) is the time-varying learning parameter and h(n) is the time-varying neighbourhood function. Both of them don’t have a “1/(sqrt(2*pi)*sigN)” in their terms.

    Hope this finds you well!

    Thanks!

    Bharath

  101. Danuta says:

    Excellent blog here! Also your web site loads up fast! What host are you using?
    Can I get your affiliate link to your host? I wish my website loaded up as quickly
    as yours lol

  102. azade says:

    thanks

  103. fahimeh says:

    thanks for this code, its best
    i have question about how we can access to each cluster data ??

  104. ӏ simply couldn’t go aaաay yߋur site before suggesting
    that I xtremely enjoƴed the usual info an individual suρply on youг visitorѕ?
    Is gonna be Ƅack often to check oսt new posts

  105. ajinkya says:

    do u hav any matlab code for dimention reduction by SOM technique for speech features

  106. pooja says:

    how can i use code on datasets for prediction, at end, i am difficult to evalue, which project belong to which project
    ////?????

  107. Bheki says:

    Hi, I was trying this code using finger print images and it came with an error that “Error using –
    Matrix dimensions must agree.”
    What have I done wrong.

    This is the only change I made
    data = double (‘C:\Users\Makhosi\Desktop\Project\finger_Print_Images\’);

  108. anuja says:

    HI Chi,
    I am trying to do clustering/ classification of a multidimentional data using SOM. I am new to SOM, and would really appreciate your help. Can you provide some more code example about SOM(Hello world-color classification code)

    I really look forward to hearing back from you. Thanks

    You can reply me at anuja.bokhare@sicsr.ac.in or here as per your convinience.
    regards,
    anuja

    • SU says:

      Hello,

      I have the same problem:( If u solved your problem, could u pls help me how you achieved this? I need the code of SOM for clustering to multidimentional data very urgently:(

      awaiting your email with returning.

      Thanks alot,

      SU

    • Ed says:

      Hi. I read your post. Were you able to solve your problem? I have the same problem to solve as well. I certainly appreciate it very much if you can share the codes to me. My email imagemaker567@gmail.com. Thank you very much in advance.

  109. anuja says:

    what is data in the code pl reply

  110. Petrichor says:

    Hi Chi,
    Thank you very much for posting the code. 🙂

  111. Richa Vedpathak says:

    hi,
    My project is related to gesture recognition using som-Hebb classifier. i have used SOM code similar to you algo. But i am unable to map hebb with it . And i think there is need for optimization? Can you send me source code of SOM-Hebb code which can give proper results during classification.

  112. aaron says:

    Hi, would you please help me in using Self organizing map for classification of EEG signals. Thank you

  113. shirin says:

    plzzz i need matlab code for classification with using self organizing map .!!!anybody can help me please

  114. Ed says:

    Hi to all. I’m new in MatLab, if anybody can share to me how to solve its problem re “data” in the code I would certainly appreciate it very much. I’m trying to study how the conventional SOM works. Hope somebody could help me.

  115. o says:

    L’ancienne vedette Morehead Etat a également bien performé pendant la campagne de l’équipe américaine à la Coupe du Monde FIBA ??Basketball 2014 en Espagne.

Leave a reply to John Cancel reply