Singular value decomposition

If matrix A has a matrix of eigenvectors P that is not invertible, then A does not have Eigen decomposition too. However, if A is an m x n real matrix with m>n, then the original matrix A can be written using a so-called singular value decomposition of the form (as the product of three matrices) U, Σ, V*. Suppose we have the following matrix:

matrix = np.matrix(
    [[6, 8],
    [5, 7]] )

Now the SVD can be computed by calling the svd() method from the NumPy module of Python as follows:

svd = np.linalg.svd(matrix)

This is an array that has three fields–that is, u, sigma, and v:

U = svd[0]
Sigma = svd[1]
V = svd[2]

For better interpretation of the preceding result, let's do some transformation–that is, converting each field ...

Get Predictive Analytics with TensorFlow now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.