See MAHOUT-1193. Feel free to grab that code, torture it, and tell us if it is any good.
If it is useful, we can commit it. On Thu, Apr 18, 2013 at 3:34 PM, Ted Dunning <ted.dunn...@gmail.com> wrote: > I hadn't planned to since I don't have cycles to properly test it. > > Let me see if I can dig it back up to see if anybody else wants to. > > SparseMatrix may be good enough for you. > > > On Thu, Apr 18, 2013 at 2:48 PM, Gokhan Capan <gkhn...@gmail.com> wrote: > >> Ted, >> >> Are you going to commit this? >> >> >> On Thu, Apr 18, 2013 at 5:18 PM, Ted Dunning <ted.dunn...@gmail.com> >> wrote: >> >> > Actually, I built a BlockSparseMatrix some time ago that does this. >> > >> > It was just like our current row sparse matrix except that it allowed >> for >> > blocks instead of rows. >> > >> > It did assume sparse matrices where the data existed. >> > >> > Worked a charm on the app in question. >> > >> > It doesn't appear that I committed it. >> > >> > >> > >> > >> > On Thu, Apr 18, 2013 at 7:02 AM, Gokhan Capan <gkhn...@gmail.com> >> wrote: >> > >> > > Ok, I'll do that. >> > > >> > > Thank you, Jake. >> > > >> > > >> > > On Thu, Apr 18, 2013 at 4:43 AM, Jake Mannix <jake.man...@gmail.com> >> > > wrote: >> > > >> > > > SparseMatrix is implemented as a Map<Integer, Vector>, you could >> modify >> > > > that class to allow you to chose between dense or sparse rows at >> > > > construction time. >> > > > >> > > > >> > > > On Wed, Apr 17, 2013 at 4:01 PM, Robin Anil <robin.a...@gmail.com> >> > > wrote: >> > > > >> > > > > Yes! Yes! Go for it!. >> > > > > On Apr 17, 2013 5:52 PM, "Gokhan Capan" <gkhn...@gmail.com> >> wrote: >> > > > > >> > > > > > I didn't quite get that, and assuming you tell me to implement >> it >> > > > > > >> > > > > > Thanks >> > > > > > >> > > > > > >> > > > > > On Thu, Apr 18, 2013 at 1:44 AM, Robin Anil < >> robin.a...@gmail.com> >> > > > > wrote: >> > > > > > >> > > > > > > Make one? >> > > > > > > On Apr 17, 2013 5:37 PM, "Gokhan Capan" <gkhn...@gmail.com> >> > wrote: >> > > > > > > >> > > > > > > > Robin, >> > > > > > > > >> > > > > > > > Aren't SparseRowMatrix rows are sparse vectors? In my use >> case >> > > row >> > > > > > > vectors >> > > > > > > > don't need to be sparse, they are either full or empty. >> > > > > > > > >> > > > > > > > >> > > > > > > > On Thu, Apr 18, 2013 at 1:32 AM, Robin Anil < >> > > robin.a...@gmail.com> >> > > > > > > wrote: >> > > > > > > > >> > > > > > > > > SparseRowMatrix? >> > > > > > > > > On Apr 17, 2013 5:26 PM, "Gokhan Capan" < >> gkhn...@gmail.com> >> > > > wrote: >> > > > > > > > > >> > > > > > > > > > Hi, >> > > > > > > > > > >> > > > > > > > > > Using Mahout Matrix interface I want to represent some >> data >> > > > where >> > > > > > the >> > > > > > > > row >> > > > > > > > > > vector is dense iff an instance is associated to this >> row >> > > > index, >> > > > > > > empty >> > > > > > > > > > otherwise. The max possible index for rows (a.k.a. >> rowSize) >> > > is >> > > > > > > defined. >> > > > > > > > > > >> > > > > > > > > > I never query the matrix by column. >> > > > > > > > > > I want to be able to add rows if the rowId is not larger >> > than >> > > > the >> > > > > > > > > rowSize. >> > > > > > > > > > >> > > > > > > > > > Does a matrix implementation exist that I can use, or >> > should >> > > I >> > > > > > write >> > > > > > > > one? >> > > > > > > > > > >> > > > > > > > > > Not to cause an XY problem, here is the particular use >> > case: >> > > > > > > > > > I row-index a latent factor matrix (for recommendation) >> > with >> > > > > > userIDs >> > > > > > > > (and >> > > > > > > > > > itemIDs for the other matrix). I need fast access to a >> row >> > > > vector >> > > > > > (to >> > > > > > > > > > estimate a score for a user-item pair) >> > > > > > > > > > >> > > > > > > > > > I tried a SparseColumnMatrix, which degrades -it is >> > designed >> > > > for >> > > > > > fast >> > > > > > > > > > access by column- the performance. I may use a >> DenseMatrix, >> > > > which >> > > > > > > would >> > > > > > > > > > either bring a memory overhead (by allocating row >> vectors >> > for >> > > > > empty >> > > > > > > > > rows), >> > > > > > > > > > or result in losing the ability to add new rows (if I >> map >> > the >> > > > > > userIds >> > > > > > > > to >> > > > > > > > > > {1,2,...,noOfCurrentUsers} space) >> > > > > > > > > > >> > > > > > > > > > Thanks >> > > > > > > > > > >> > > > > > > > > > -- >> > > > > > > > > > Gokhan >> > > > > > > > > > >> > > > > > > > > >> > > > > > > > >> > > > > > > > >> > > > > > > > >> > > > > > > > -- >> > > > > > > > Gokhan >> > > > > > > > >> > > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > -- >> > > > > > Gokhan >> > > > > > >> > > > > >> > > > >> > > > >> > > > >> > > > -- >> > > > >> > > > -jake >> > > > >> > > >> > > >> > > >> > > -- >> > > Gokhan >> > > >> > >> >> >> >> -- >> Gokhan >> > >