org.apache.mahout.utils.vectors.arff
Class ARFFVectorIterable
java.lang.Object
org.apache.mahout.utils.vectors.arff.ARFFVectorIterable
- All Implemented Interfaces:
- Iterable<Vector>
public class ARFFVectorIterable
- extends Object
- implements Iterable<Vector>
Read in ARFF (http://www.cs.waikato.ac.nz/~ml/weka/arff.html) and create Vector
s
Attribute type handling:
- Numeric -> As is
- Nominal -> ordinal(value) i.e. @attribute lumber {'\'(-inf-0.5]\'','\'(0.5-inf)\''}
will convert -inf-0.5 -> 0, and 0.5-inf -> 1
- Dates -> Convert to time as a long
- Strings -> Create a map of String -> long
NOTE: This class does not set the label bindings on every vector. If you want the label
bindings, call MapBackedARFFModel.getLabelBindings()
, as they are the same for every vector.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ARFFVectorIterable
public ARFFVectorIterable(File file,
ARFFModel model)
throws IOException
- Throws:
IOException
ARFFVectorIterable
public ARFFVectorIterable(File file,
Charset encoding,
ARFFModel model)
throws IOException
- Throws:
IOException
ARFFVectorIterable
public ARFFVectorIterable(String arff,
ARFFModel model)
throws IOException
- Throws:
IOException
ARFFVectorIterable
public ARFFVectorIterable(Reader reader,
ARFFModel model)
throws IOException
- Throws:
IOException
iterator
public Iterator<Vector> iterator()
- Specified by:
iterator
in interface Iterable<Vector>
getModel
public ARFFModel getModel()
- Returns info about the ARFF content that was parsed.
- Returns:
- the model
Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.