Svd.
singular_values[:k, :k]), right_singular_vectors[:, :k].T) # Print the original and reduced datasets print("Original Dataset:") print(dataset) print("\nReduced Dataset:") print(reduced_dataset) Original Dataset: [[2 1 0 4] [3 4 0 2] [1 1 0 5] [0 2 5 0] [4 0 1 2]] Reduced Dataset: [[ 1.44147826e+00