Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HitMapView and BmuHitsView have inverted positions #98

Open
ricardomourarpm opened this issue Jan 30, 2019 · 2 comments
Open

HitMapView and BmuHitsView have inverted positions #98

ricardomourarpm opened this issue Jan 30, 2019 · 2 comments

Comments

@ricardomourarpm
Copy link
Contributor

Dear all,

When performing a clusterization of underwater acoustic files I wanted to observe the hitsmap of all the nodes and see it conjointly with the cluster atribution by node.

That is, the HitMapView and the BmuHitsView.

If you see the images bellow

image

image

what happens is that the node with 14 hits is in fact located in cluster 7, that is, in the opposite direction. With carefull watching, observing the location of every individual in the node atribution and the cluster atribution, I concluded that they are all in inverted position.

I'm going to observe the code and see where it may be corrected. Meanwhile if you may find it first I appreciate.

Thank you,

Ricardo

@ricardomourarpm
Copy link
Contributor Author

I observed that in bmuhits.py we have,

    elif som.codebook.lattice == "hexa":
        ax, cents = plot_hex_map(mp[::-1], colormap=cmap, fig=self._fig)
        if anotate:
            self._set_labels(cents, ax, reversed(counts), onlyzeros, labelsize, hex=True)

That is, we have reversed(counts) while in hitmap.py

    elif som.codebook.lattice == "hexa":
        ax, cents = plot_hex_map(np.flip(clusters.reshape(msz[0], msz[1])[::], axis=1),  fig=self._fig, 
                                                 colormap=cmap, colorbar=False)
        if anotate:
            self._set_labels(cents, ax, clusters, onlyzeros, labelsize, hex=True)

That is we do not have reversed. By replacing reversed(counts) by only counts, the maps now coincide.

Should I instead put reversed(clusters)? (nodes position can star from bottom right)

Thank you!

@ricardomourarpm
Copy link
Contributor Author

ricardomourarpm commented Feb 26, 2019

Ok! Now that I have been thorough through the code I observed the following:

plot_hex_map should be called like

     plot_hex_map(np.flip(Nodes_with_selected_variables.values.reshape(som_chosen.codebook.mapsize +
                                                          [Nodes_with_selected_variables.values.shape[-1]]),axis=0),
         titles=Nodes_with_selected_variables.columns, shape=[1, 3], colormap=None)

we shoud flip across axis=0

and the file hitmap.py should be changed also in the end as

    elif som.codebook.lattice == "hexa":
        ax, cents = plot_hex_map(np.flip(clusters.reshape(msz[0], msz[1])[::], axis=0),  fig=self._fig, colormap=cmap, colorbar=False)
        if anotate:
            self._set_labels(cents, ax, reversed(clusters), onlyzeros, labelsize, hex=True)

also flipping across axis=0 and putting reversed(clusters) to match the visualizations produced in bmuhits.py.

Please check this!

Thanks for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant