Using Singular Value Decomposition (SVD), we can come up with a more generalized set of features to represent the user-item preferences for a large dataset using dimensionality reduction techniques. This approach helps to generalize users into lesser dimensions.
The following is the Java code example for SVD using ALS-WR as the factorizer; the number of target features should be given as input, which in this case (3. 0.065
) is given as lambda (the regularization parameter), and the number of iterations is given as 1
:
DataModel svdmodel = new FileDataModel (new File("movie.csv")); ALSWRFactorizer factorizer = new ALSWRFactorizer(svdmodel, 3, 0.065, 1); Recommender svdrecommender = new SVDRecommender(svdmodel, factorizer); for (RecommendedItem recommendation :svdrecommender.recommend(3,1)) { System.out.println(recommendation); }
The following is the output of the preceding code:
RecommendedItem[item:3, value:7.2046385]
The following is the command-line execution...