GithubHelp home page GithubHelp logo

Comments (6)

JustGlowing avatar JustGlowing commented on July 22, 2024

hi @Pedro-V thanks for raising this.

I'm struggling to understand you point. Looking at the vector in um that you are referring to:

[17.  4.  3.  1.  2.  4. nan nan]

The middle weight in your snippet is considered to have 6 neighbors. Which can be seen as the ones highlighted here in red:

image

Please clarify your point if this doesn't clear your doubts.

from minisom.

Pedro-V avatar Pedro-V commented on July 22, 2024

Hi @JustGlowing thanks for taking the time.

The thing is, the ones highlighted in red are not the ones that the um says the middle neuron is bordering! This is the problem I noticed.

The following is a mapping between each neighbor of the middle neuron (the red ones in your adapted image) and its distance to it. * denotes a neuron whose distance is present in um[1, 1].

neuron value distance distance present in um[1, 1]?
22 2 Yes
29 5 No
28 4 Yes
7 17 Yes
20 4 Yes
25 1 Yes

See how the neuron with 29 value doesn't have his distance in um[1,1]?
That's the reason I raised the issue. Why is 29 not present in the the middle neuron neighborhood? Indeed, executing the code of the method in a debugger shows it is not considered in the neighborhood of the middle neuron.

If this is a misunderstood, I'm sorry for taking your time 😆

from minisom.

JustGlowing avatar JustGlowing commented on July 22, 2024

Just to clarify, you might be right but I want to understand if there's an actual issue before jumping into fixing it.

Notice that in your table the the neuron with value 15 is missing and it is also excluded by the computation of um[1,1].

Why is 29 not present in the the middle neuron neighborhood?

29 and also 15 are excluded as an hexagonal neighborhood only has 6 elements. We could have excluded any other 2 elements by rearranging the coordinates system.

I'm I still missing something?

from minisom.

Pedro-V avatar Pedro-V commented on July 22, 2024

We could have excluded any other 2 elements by rearranging the coordinates system.

I see. I thought that the coordinate was arranged in a way such that the array would be like the following

15   22   29
  25   24   28
21   20   7

Such that the middle neuron (24) woul have his neighborhood as 25, 20, 7, 22, 29, 28, because that would make sense "visually".

Again, thanks for taking the time. I'll close this issue.

from minisom.

Pedro-V avatar Pedro-V commented on July 22, 2024

Hello @JustGlowing, I'm reopening this because of further doubt.

Again, suppose the same ii, jj lists for helping define the neighborhood of the neuron. Also suppose the following code:

ii = [[-1,  0, 0,  1, 1, 1], [-1, -1, -1,  0, 0, 1]]
jj = [[ 0, -1, 1, -1, 0, 1], [-1,  0,  1, -1, 1, 0]]

n, m = 3, 3

for x in range(n):
    for y in range(m):
        print(f'For {x, y}: ', end=' ')
        e = y % 2 == 0
        for k, (i, j) in enumerate(zip(ii[e], jj[e])):
            if (x + i >= 0 and x + i < n and
                y + j >= 0 and y + j < m):
                print(f'{x+i, y+j}', end=' ')
        print()

It outputs the following:

For (0, 0):  (0, 1) (1, 0) 
For (0, 1):  (0, 0) (0, 2) (1, 0) (1, 1) (1, 2) 
For (0, 2):  (0, 1) (1, 2) 
For (1, 0):  (0, 0) (0, 1) (1, 1) (2, 0) 
For (1, 1):  (0, 1) (1, 0) (1, 2) (2, 0) (2, 1) (2, 2) 
For (1, 2):  (0, 1) (0, 2) (1, 1) (2, 2) 
For (2, 0):  (1, 0) (1, 1) (2, 1) 
For (2, 1):  (1, 1) (2, 0) (2, 2) 
For (2, 2):  (1, 1) (1, 2) (2, 1) 

Consider the same map graph:

Now take the neuron (1, 0). In the above image, it has 5 neighbors:

(0, 0)      (0, 1)
        (1, 0)       (1, 1)
(2, 0)       (2, 1)

My question is why the code used in the MiniSom.distance_map method considers only 4 of that neuron's 5 neighbors.

Note that there are some other neurons with different number of reported neighbors that the image presented.

Thanks.

from minisom.

Pedro-V avatar Pedro-V commented on July 22, 2024

After working out in a paper sheet, I now understand. I misunderstood minisom concept of a hexagonal grid. Visually, minisom sees a hexagonal 3x3 grid like this:

 2
1 3
 5
4 6
 8
7 9

That is, the variations occur in the y axis. The current code is appropriate for this view.
I was thinking it saw like this:

1 2 3
 4 5 6
7 8 9

Where the variations occur in the x axis.
Again, closing this issue. But definitely this time.

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.