Documentation of 'smile.data.parser.SparseDatasetParser' Java class
SparseDatasetParser
smile.data.parser

Class SparseDatasetParser



  • public class SparseDatasetParser
    extends java.lang.Object
    Parser for spare dataset in coordinate triple tuple list format. Coordinate file stores a list of (row, column, value) tuples:
     instanceID attributeID value
     instanceID attributeID value
     instanceID attributeID value
     instanceID attributeID value
     ...
     instanceID attributeID value
     instanceID attributeID value
     instanceID attributeID value
     
    Ideally, 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 attributes
     
    or 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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      SparseDataset parse(java.io.File file)
      Parse a sparse dataset from given file.
      SparseDataset parse(java.io.InputStream stream)
      Parse a sparse dataset from an input stream.
      SparseDataset parse(java.lang.String path)
      Parse a sparse dataset from given file.
      SparseDataset parse(java.lang.String name, java.io.File file)
      Parse a sparse dataset from given file.
      SparseDataset parse(java.lang.String name, java.io.InputStream stream)
      Parse a sparse dataset from an input stream.
      SparseDataset parse(java.lang.String name, java.lang.String path)
      Parse a sparse dataset from given file.
      SparseDataset parse(java.lang.String name, java.net.URI uri)
      Parse a sparse dataset from given URI.
      SparseDataset parse(java.net.URI uri)
      Parse a sparse dataset from given URI.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SparseDatasetParser

        public SparseDatasetParser()
        Constructor.
      • SparseDatasetParser

        public SparseDatasetParser(int arrayIndexOrigin)
        Constructor.
        Parameters:
        arrayIndexOrigin - 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.
    • Method Detail

      • parse

        public SparseDataset parse(java.net.URI uri)
                            throws java.io.IOException,
                                   java.text.ParseException
        Parse a sparse dataset from given URI.
        Throws:
        java.io.IOException
        java.text.ParseException
      • parse

        public SparseDataset parse(java.lang.String name,
                                   java.net.URI uri)
                            throws java.io.IOException,
                                   java.text.ParseException
        Parse a sparse dataset from given URI.
        Parameters:
        uri - the URI of data source.
        Throws:
        java.io.IOException
        java.text.ParseException
      • parse

        public SparseDataset parse(java.lang.String path)
                            throws java.io.IOException,
                                   java.text.ParseException
        Parse a sparse dataset from given file.
        Throws:
        java.io.IOException
        java.text.ParseException
      • parse

        public SparseDataset parse(java.lang.String name,
                                   java.lang.String path)
                            throws java.io.IOException,
                                   java.text.ParseException
        Parse a sparse dataset from given file.
        Parameters:
        path - the file path of data source.
        Throws:
        java.io.IOException
        java.text.ParseException
      • parse

        public SparseDataset parse(java.io.File file)
                            throws java.io.IOException,
                                   java.text.ParseException
        Parse a sparse dataset from given file.
        Throws:
        java.io.IOException
        java.text.ParseException
      • parse

        public SparseDataset parse(java.lang.String name,
                                   java.io.File file)
                            throws java.io.IOException,
                                   java.text.ParseException
        Parse a sparse dataset from given file.
        Parameters:
        file - the file of data source.
        Throws:
        java.io.IOException
        java.text.ParseException
      • parse

        public SparseDataset parse(java.io.InputStream stream)
                            throws java.io.IOException,
                                   java.text.ParseException
        Parse a sparse dataset from an input stream.
        Parameters:
        stream - the input stream of data.
        Throws:
        java.io.IOException
        java.text.ParseException
      • parse

        public SparseDataset parse(java.lang.String name,
                                   java.io.InputStream stream)
                            throws java.io.IOException,
                                   java.text.ParseException
        Parse a sparse dataset from an input stream.
        Parameters:
        name - the name of dataset.
        stream - the input stream of data.
        Throws:
        java.io.IOException
        java.text.ParseException

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.