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

Orientation of PCA Initialisation #124

Open
MattWenham opened this issue Apr 24, 2018 · 3 comments
Open

Orientation of PCA Initialisation #124

MattWenham opened this issue Apr 24, 2018 · 3 comments
Labels

Comments

@MattWenham
Copy link
Contributor

MattWenham commented Apr 24, 2018

If I wish to set the ratio of the map dimensions to be the ratio of the first two eigenvalues from PCA, should the larger value be n_rows or n_columns? I think this tidbit would be useful to add in to the Python user guide, and perhaps others.

@peterwittek
Copy link
Owner

Columns, I guess, unless you prefer vertically elongated maps. If you find this important, I would welcome a PR to the Python documentation.

@MattWenham
Copy link
Contributor Author

More fundamentally, my question boils down to this: is the first principal component projected across the columns or down the rows of the initialised map? In the first case, n_columns should be larger than n_rows, and vice-versa for the second case.

@peterwittek
Copy link
Owner

The actual 'projection' is this loop:

for j in range(n_columns * n_rows):
    for i in range(eigvec.shape[0]):
        codebook[j, :] = codebook[j, :] + \
            coord[j, i] * eigvec[i, :]

The codebook is initialized with the mean value of each dimension. Then this loop shifts the mean with both eigenvectors, where the scaling factor is given by the coord array, which introduces larger coefficients further away from the centre of the map. So I don't think the shape of the map actually matters.

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

No branches or pull requests

2 participants