NYU-DLSP20
NYU-DLSP20 copied to clipboard
02 space stretching linear transformation should it be Y=X@W instead of [email protected]()?
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)
I think X
has its samples as rows. So y = Wx
becomes y' = x'W'
.
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
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())
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?