public class LibsvmParser extends Object
<label> <index1>:<value1> <index2>:<value2> ...
where <label> is the target value of the training data. For classification, it should be an integer which identifies a class (multi-class classification is supported). For regression, it's any real number. For one-class SVM, it's not used so can be any number. <index> is an integer starting from 1, and <value> is a real number. The indices must be in an ascending order. The labels in the testing data file are only used to calculate accuracy or error. If they are unknown, just fill this column with a number.
| Constructor and Description |
|---|
LibsvmParser()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
SparseDataset |
parse(File file)
Parse a libsvm sparse dataset from given file.
|
SparseDataset |
parse(String path)
Parse a libsvm sparse dataset from given file.
|
SparseDataset |
parse(String name,
File file)
Parse a libsvm sparse dataset from given file.
|
SparseDataset |
parse(String name,
InputStream stream)
Parse a libsvm sparse dataset from an input stream.
|
SparseDataset |
parse(String name,
String path)
Parse a libsvm sparse dataset from given file.
|
SparseDataset |
parse(String name,
URI uri)
Parse a libsvm sparse dataset from given URI.
|
SparseDataset |
parse(URI uri)
Parse a libsvm sparse dataset from given URI.
|
public SparseDataset parse(URI uri) throws FileNotFoundException, IOException, ParseException
public SparseDataset parse(String name, URI uri) throws FileNotFoundException, IOException, ParseException
uri - the URI of data source.FileNotFoundExceptionIOExceptionParseExceptionpublic SparseDataset parse(String path) throws FileNotFoundException, IOException, ParseException
public SparseDataset parse(String name, String path) throws FileNotFoundException, IOException, ParseException
path - the file path of data source.FileNotFoundExceptionIOExceptionParseExceptionpublic SparseDataset parse(File file) throws FileNotFoundException, IOException, ParseException
public SparseDataset parse(String name, File file) throws FileNotFoundException, IOException, ParseException
file - the file of data source.FileNotFoundExceptionIOExceptionParseExceptionpublic SparseDataset parse(String name, InputStream stream) throws IOException, ParseException
name - the name of dataset.stream - the input stream of data.FileNotFoundExceptionIOExceptionParseExceptionCopyright © 2015. All rights reserved.