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 and Description |
---|
DataFileIterator(File dataFile) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected Pair<PreferenceArray,long[]> |
computeNext() |
void |
skip(int n)
Skip the next n elements supplied by this
Iterator . |
endOfData, hasNext, next, peek
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining, hasNext, next, remove
public DataFileIterator(File dataFile) throws IOException
IOException
protected Pair<PreferenceArray,long[]> computeNext()
computeNext
in class com.google.common.collect.AbstractIterator<Pair<PreferenceArray,long[]>>
public void skip(int n)
SkippingIterator
Iterator
. If there are less than n elements remaining,
this skips all remaining elements in the Iterator
. This method has the same effect as calling
Iterator.next()
n times, except that it will never throw NoSuchElementException
.skip
in interface SkippingIterator<Pair<PreferenceArray,long[]>>
public void close()
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.