-
Notifications
You must be signed in to change notification settings - Fork 67
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
Misleading Somoclu.get_bmus()
result
#145
Comments
Thanks. Could you check if it is the simple |
giacomolanciano
added a commit
to giacomolanciano/somoclu
that referenced
this issue
Oct 25, 2019
…umpy array in Somoclu.get_bmus()
Hi @xgdgsc, thanks for following up on this. I have slightly updated the issue description to better explain what is my expected result. In case of if order == 'F':
return np.vstack((X, Y)).T
elif order == 'C':
return np.vstack((Y, X)).T For convenience, I have also implemented the fix in PR #146. |
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I'd like to point out a possible source of confusion in the implementation of
Somoclu.get_bmus()
. Here's an example output:The BMUs indices are returned as a 2D numpy array, each row indicating the BMU for the corresponding sample. Individual BMU indices are 1D numpy arrays, represented in a
[column, row]
format. Such format totally makes sense if you look at the map as a cartesian plan (I'm guessing this is your interpretation because of the naming convention used in the source code:X
andY
overcol
androw
, respectively).Although, such design choice is not documented anywhere and, as in my case, it could be a source of problems if one uses the returned BMUs indices to access the corresponding map's cells (i.e., columns are treated as rows and vice-versa). If it was explicitly documented, one could have known that, for instance, a
numpy.flip(..., axis=1)
is needed to transform the result in advance.Possibly, the method could be improved by adding an
order
parameter (in line with what numpy does) to let the user pick the desired format. The method's signature could be something likewith
order
accepting'F'
for column-major order (i.e., the current default) and'C'
for row-major order. In this way, referring to the example above, settingorder='C'
would produce the following output instead:Thanks for your consideration and for the effort put in developing this great package, I've found it very useful to produce the source code for a recent publication of mine.
The text was updated successfully, but these errors were encountered: