org.apache.mahout.cf.taste.example.kddcup
Class DataFileIterator

java.lang.Object
  extended by com.google.common.collect.UnmodifiableIterator<T>
      extended by com.google.common.collect.AbstractIterator<Pair<PreferenceArray,long[]>>
          extended by org.apache.mahout.cf.taste.example.kddcup.DataFileIterator
All Implemented Interfaces:
Closeable, Iterator<Pair<PreferenceArray,long[]>>, SkippingIterator<Pair<PreferenceArray,long[]>>

public final class DataFileIterator
extends com.google.common.collect.AbstractIterator<Pair<PreferenceArray,long[]>>
implements SkippingIterator<Pair<PreferenceArray,long[]>>, Closeable

An Iterator which iterates over any of the KDD Cup's rating files. These include the files {train,test,validation}Idx{1,2}}.txt. See http://kddcup.yahoo.com/. Each element in the iteration corresponds to one user's ratings as a PreferenceArray and corresponding timestamps as a parallel long array.

Timestamps in the data set are relative to some unknown point in time, for anonymity. They are assumed to be relative to the epoch, time 0, or January 1 1970, for purposes here.


Constructor Summary
DataFileIterator(File dataFile)
           
 
Method Summary
 void close()
           
protected  Pair<PreferenceArray,long[]> computeNext()
           
 void skip(int n)
           
 
Methods inherited from class com.google.common.collect.AbstractIterator
endOfData, hasNext, next, peek
 
Methods inherited from class com.google.common.collect.UnmodifiableIterator
remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Constructor Detail

DataFileIterator

public DataFileIterator(File dataFile)
                 throws IOException
Throws:
IOException
Method Detail

computeNext

protected Pair<PreferenceArray,long[]> computeNext()
Specified by:
computeNext in class com.google.common.collect.AbstractIterator<Pair<PreferenceArray,long[]>>

skip

public void skip(int n)
Specified by:
skip in interface SkippingIterator<Pair<PreferenceArray,long[]>>

close

public void close()
Specified by:
close in interface Closeable


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.