NYU-DLSP20 icon indicating copy to clipboard operation
NYU-DLSP20 copied to clipboard

02 space stretching linear transformation should it be Y=X@W instead of [email protected]()?

Open ddgg opened this issue 4 years ago • 4 comments

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)

ddgg avatar May 13 '20 21:05 ddgg

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

Atcold avatar May 13 '20 21:05 Atcold

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 avatar May 14 '20 01:05 ddgg

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())

ddgg avatar May 14 '20 19:05 ddgg

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?

Atcold avatar May 23 '20 02:05 Atcold