mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Runo <matthew.r...@gmail.com>
Subject Getting itemIDs out of a dataModel?
Date Fri, 04 Feb 2011 22:33:08 GMT
Hello -

I took a quick stab at precomputing item-item similarities recently,
and it seems like I'm not getting the itemIDs that I should be:

 Iterator iter = dataModel.getItemIDs();
 while( iter.hasNext() ){
    long item1 = (Long) iter.next();

    Iterator inner = dataModel.getItemIDs();
    while( inner.hasNext() ){
        long item2 = (Long) inner.next();
        cache.add(
                  new GenericItemSimilarity.ItemItemSimilarity(item1,
item2, itemSimilarity.itemSimilarity(item1, item2))
                );
...

I get an itemID that is not found in my input data at all. I do,
however, find it as a userID. My data is currently a flat file:

itemID,userID,time,pref

for example..

705540,3472328326359560240,1288681200,10

I can only assume that this is not the proper way to loop through all
the itemIDs inside the dataModel. How would you do that? I'd expect to
get 705540 from the line above..

Thanks for your time!

Matthew Runo

Mime
View raw message