You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Stefano Bellasio <st...@gmail.com> on 2010/11/12 09:55:36 UTC

Creating a Sparse Matrix to use with SVD

HHi guys, i'm new with Mahout and Hadoop. I tried something and right now i did some tests with recommendation (based on grouplens dataset) with Mahout and with Hadoop; i'm trying to figure out how i can use SVD for recommendations (Lanczos solver distributed with Hadoop), and i know that i need a matrix to start. So i coded something in Java using SparseDoubleMatrix2D (in the math dir of mahout) but i'm not sure of what i have to do. 

My code: 
package org.apache.mahout.math.matrix.impl; 

import org.apache.mahout.math.function.BinaryFunction; 

public class creaMatrice extends SparseDoubleMatrix2D { 

       public static void main(String args[]){ 
       double array[][]= { {1,2,4,8}, {5,0,4,5}, {2,9,1,5} }; 
       SparseDoubleMatrix2D matrice = new SparseDoubleMatrix2D(array); 
       int prova = matrice.getQuick(2,3); 

       System.out.println(prova); 

} 
} 

It's just to try if something works and the answer is "no" for now :) But firstly i have some questions about SVD, matrix and hadoop. 

1) i need to create a matrix with item-ratings and then convert it with SVD application of mahout? 
2) is there a guide or something else that can explain this? 

Thank you for your support, hope to see some helpful answer :) Stefano