public class SparseDatasetParser extends Object
instanceID attributeID value instanceID attributeID value instanceID attributeID value instanceID attributeID value ... instanceID attributeID value instanceID attributeID value instanceID attributeID valueIdeally, the entries are sorted (by row index, then column index) to improve random access times. This format is good for incremental matrix construction.
Optionally, there may be 2 header lines
D // The number of instances W // The number of attributesor 3 header lines
D // The number of instances W // The number of attributes N // The total number of nonzero items in the dataset.These header lines will be ignored.
| Constructor and Description |
|---|
SparseDatasetParser()
Constructor.
|
SparseDatasetParser(int arrayStartingIndex)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
SparseDataset |
parse(File file)
Parse a sparse dataset from given file.
|
SparseDataset |
parse(InputStream stream)
Parse a sparse dataset from an input stream.
|
SparseDataset |
parse(String path)
Parse a sparse dataset from given file.
|
SparseDataset |
parse(String name,
File file)
Parse a sparse dataset from given file.
|
SparseDataset |
parse(String name,
InputStream stream)
Parse a sparse dataset from an input stream.
|
SparseDataset |
parse(String name,
String path)
Parse a sparse dataset from given file.
|
SparseDataset |
parse(String name,
URI uri)
Parse a sparse dataset from given URI.
|
SparseDataset |
parse(URI uri)
Parse a sparse dataset from given URI.
|
public SparseDatasetParser()
public SparseDatasetParser(int arrayStartingIndex)
arrayStartingIndex - the starting index of array. By default, it is
0 as in C/C++ and Java. But it could be 1 to parse data produced
by other programming language such as Fortran.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(InputStream stream) throws IOException, ParseException
stream - the input stream of data.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.