Coder Social home page Coder Social logo

Comments (6)

JustGlowing avatar JustGlowing commented on June 14, 2024

from minisom.

JanDetroy avatar JanDetroy commented on June 14, 2024

Hey,
I think I have the same Issue. I get a index out of bounds error, when I try to compute the topographical error using a hexagonal grid. Not using a hexagonal grid the topographical error can be computed just fine.
I am calling the som.topographical_error() function with my data as an argument.
te = som.topographic_error(data)
When not using a hexagonal grid the topographical error can be computed. However when using a hexagonal grid I get the following error:

~/.venvs/viewer/lib/python3.7/site-packages/minisom.py in topographic_error(self, data)
    558             return nan
    559         if self.topology == 'hexagonal':
--> 560             return self._topographic_error_hexagonal(data)
...
--> 245         return self._xx.T[xy], self._yy.T[xy]
    246 
    247     def _activate(self, x):

IndexError: index 5 is out of bounds for axis 1 with size 5

Hope that helps somehow.

from minisom.

JustGlowing avatar JustGlowing commented on June 14, 2024

This must be bug then. I'll reopen the issue. Unfortunately I don't have time to fix this in the short term.

from minisom.

JustGlowing avatar JustGlowing commented on June 14, 2024

A correction, I can't replicate this error as I'm able to compute the topographic error using the hexagonal topology under different setups. You need to share more details about your situation if you want any support with this.

from minisom.

JanDetroy avatar JanDetroy commented on June 14, 2024

Hey,
Thanks for the super fast reply. I create a som, initialise it with weights according to the pca and train it. Afterwards I try to compute the topographic error which results in the out of bounds error. This is the code that I am running:

som_size = [6,5]
som = MiniSom(som_size[0], som_size[1], np.size(data,1), sigma=1.5, learning_rate=0.8,topology='hexagonal')
som.pca_weights_init(data)
som.train(data, 100000,verbose=False,random_order=True)

te = som.topographic_error(data)

from minisom.

JanDetroy avatar JanDetroy commented on June 14, 2024

I don't think this line of code makes sense:

coords = som.convert_map_to_euclidean((index % y, int(index/y)))

Shouldn't the parameters be inverted, e.g.:

coords = som.convert_map_to_euclidean((int(index/y), index % y))

Anyway, thanks for the amazing work!

The change from above fixed the issue for me!

from minisom.

Related Issues (20)

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.