public class MLUtils$ extends Object
This object contains convenience functions for machine learning tasks:
- readLibSVM:
Reads a libSVM/SVMLight input file and returns a data set of LabeledVector
.
The file format is specified [http://svmlight.joachims.org/ here].
- writeLibSVM:
Writes a data set of LabeledVector
in libSVM/SVMLight format to disk. THe file format
is specified [http://svmlight.joachims.org/ here].
Modifier and Type | Field and Description |
---|---|
static MLUtils$ |
MODULE$
Static reference to the singleton instance of this Scala object.
|
Constructor and Description |
---|
MLUtils$() |
Modifier and Type | Method and Description |
---|---|
String |
DIMENSION() |
DataSet<LabeledVector> |
readLibSVM(ExecutionEnvironment env,
String filePath)
Reads a file in libSVM/SVMLight format and converts the data into a data set of
LabeledVector . |
DataSink<String> |
writeLibSVM(String filePath,
DataSet<LabeledVector> labeledVectors)
Writes a
DataSet of LabeledVector to a file using the libSVM/SVMLight format. |
public static final MLUtils$ MODULE$
public String DIMENSION()
public DataSet<LabeledVector> readLibSVM(ExecutionEnvironment env, String filePath)
LabeledVector
. The dimension of the LabeledVector
is determined automatically.
Since the libSVM/SVMLight format stores a vector in its sparse form, the LabeledVector
will also be instantiated with a SparseVector
.
env
- executionEnvironment ExecutionEnvironment
filePath
- Path to the input fileDataSet
of LabeledVector
containing the information of the libSVM/SVMLight
filepublic DataSink<String> writeLibSVM(String filePath, DataSet<LabeledVector> labeledVectors)
DataSet
of LabeledVector
to a file using the libSVM/SVMLight format.
filePath
- Path to output filelabeledVectors
- DataSet
of LabeledVector
to write to diskCopyright © 2014–2017 The Apache Software Foundation. All rights reserved.