Matrix Factorization is a technique used in Recommender Systems to reduce the dimensionality of a large user-item interaction matrix. The goal is to find a lower-dimensional representation of the matrix, where users and items are represented as vectors. This can be achieved using Singular Value Decomposition (SVD) or Non-negative Matrix Factorization (NMF).
**Example:** Given a user-item interaction matrix, factorize it into two lower-dimensional matrices, one for users and one for items.
**Constraints:** The user and item matrices should have the same number of columns as the original matrix has rows.
Test Cases
Test Case 1
Input:
[[1, 2, 0], [0, 0, 3], [0, 1, 0], [1, 0, 0]]Expected:
[[0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [0.5, 0.5, 0.5]]Test Case 2
Input:
[[0, 1, 0], [1, 0, 1], [0, 1, 0], [1, 0, 1]]Expected:
[[0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [0.5, 0.5, 0.5]]+ 3 hidden test cases