2
$\begingroup$

I've been playing around with self organizing maps (SOM) recently.

I tried to implement a simple example. You can see the training implementation function gist here and full contained SOM example here.

There is something strange I'm noticing and I'm not really sure why it's happening. I'm using the iris data set to both train and validate the SOM parameters. Iris data set contains data for 3 different kinds of flowers i.e. it contains 3 different groups/clusters of data.

Once I have trained the SOM I should be able to validate using the trained parameters that the Iris data really does cluster to three groups - each per flower type.

However I'm seeing something strange when validating the SOM parameters. When I normalize the input data and then try to verify/validate the trained SOM parameters using the original non-normalized iris data, the validation data seem to cluster into the same best matching unit (BMU). That is, if I normalize the input for learning and don't normalize the data for validation, I get one cluster classification instead of expected three.

However when I normalize both the input and the validation data set (like I said validation data is the same data set as the one used for training the SOM - iris data set), I do get the expected result - i.e. the data does cluster into 3 [clearly identifiable] clusters.

Equally, when I don't normalize either of the data sets I get the expected validation results.

So my question is, what would be the potential cause of the first case be: ie. training the model on normalized data and getting incorrect results when validating the model using the exact same data as validation data, but not non-normalized.

I would expect that normalizing the data to train the SOM model should have no effect on validation i.e. that once you have the model parameters, you should be able to classify non-normalized data.

I'm guessing that this could be because of using the same data set for training and validation?

$\endgroup$
  • $\begingroup$ You need to make this self-contained. People aren't going to want to navigate elsewhere and read a lot of stuff to answer your question for you. In addition, are you just asking for code check? That would be off topic here, but can be on topic on the Code Review site. $\endgroup$ – gung May 16 '16 at 19:27
  • $\begingroup$ thanks, I've modified the question. I hope it's better now :-/ $\endgroup$ – gyre May 17 '16 at 0:08
3
$\begingroup$

A common way to normalize a SOM is to scale features to unit variance. The mean is subtracted from each observation and divided by the standard deviation, which is in the range [0, 1].

If you normalize the training set, but not the validation set, then you are likely comparing observations on different scales. I'd suggest using the mean and stds of the training set to normalize the validation set.

$\endgroup$
  • 1
    $\begingroup$ Yeah… If a feature is in the range [99, 100] and you normalize it to be [0, 1] for training, but query the model with data that hasn't been normalized, all the data will just go into the bin with the value closest to 99. Is this what's happening? $\endgroup$ – alltom May 23 '17 at 5:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.