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

02 space stretching linear transformation should it be Y=X@W instead of Y=X@W.t()? #315

Open
ddgg opened this issue May 13, 2020 · 4 comments

Comments

@ddgg
Copy link

ddgg commented May 13, 2020

a simple test of shear, yellow dots should be in lower right instead of upper right, new_OI is right without transpose

for i in range(1):
    # create a random matrix
    W = torch.tensor([[1.,0.], [1.,1.]]).to(device)
    # transform points
    Y = X @ W.t()
    # compute singular values
    U, S, V = torch.svd(W)
    # plot transformed points
    show_scatterplot(Y, colors, title='y = Wx, singular values : [{:.3f}, {:.3f}]'.format(S[0], S[1]))
    # transform the basis
    new_OI = OI @ W
    # plot old and new basis
    plot_bases(OI)
    plot_bases(new_OI)
@Atcold
Copy link
Owner

Atcold commented May 13, 2020

I think X has its samples as rows. So y = Wx becomes y' = x'W'.

@ddgg
Copy link
Author

ddgg commented May 14, 2020

then for example shear should be [[1,1],[0,1]] instead of [[1,0],[1,1]] I put in, but the question will become do we need to transpose W in new_OI = OI@W?
I just think those two lines basiclly do the same thing with different W seems really odd

@ddgg
Copy link
Author

ddgg commented May 14, 2020

so, basically with W and W.t() in those 2 lines, we got either

Wrong cloud
or
Wrong post transforming axis

because those two lines are doing the same transformation(for X or axis), they should not multiple with different matrix(W or W.t())

@Atcold
Copy link
Owner

Atcold commented May 23, 2020

new_OI = OI @ W should be new_OI = OI @ W.t().
The first .t() was a bug fix, I've merged from someone.
I guess they forgot to add it to the other line?

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

2 participants