1 year ago

#380356

test-img

zdm

Why the numpy pinv did not give the correct result

I have a pseudoinverse problem as follows:

Y = W.T @ X

Where

Y.shape = (2, 800)
W.shape = (9, 2)
X.shape = (9, 800)

I have Y and X and I am looking for W. I used numpy.linalg.pinv.

W = Y @ numpy.linalg.pinv(X)

But the results did not match: I found this

W.T @ X != Y

What did I miss here?

Here is my code:

X = np.random.random(size=(9, 800))
Y = np.random.randint(low=0, high=2, size=(2, 800))
Xinv = np.linalg.pinv(X)
W = Y @ Xinv 
W @ X # != Y ???

numpy

linear-algebra

least-squares

matrix-inverse

0 Answers

Your Answer

Accepted video resources