smile.data.parser
Class LibsvmParser
- java.lang.Object
-
- smile.data.parser.LibsvmParser
-
public class LibsvmParser extends java.lang.ObjectLIBSVM (and SVMLight) data parser. The format of libsvm file is:<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 Summary
Constructors Constructor and Description LibsvmParser()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description SparseDatasetparse(java.io.File file)Parse a libsvm sparse dataset from given file.SparseDatasetparse(java.lang.String path)Parse a libsvm sparse dataset from given file.SparseDatasetparse(java.lang.String name, java.io.File file)Parse a libsvm sparse dataset from given file.SparseDatasetparse(java.lang.String name, java.io.InputStream stream)Parse a libsvm sparse dataset from an input stream.SparseDatasetparse(java.lang.String name, java.lang.String path)Parse a libsvm sparse dataset from given file.SparseDatasetparse(java.lang.String name, java.net.URI uri)Parse a libsvm sparse dataset from given URI.SparseDatasetparse(java.net.URI uri)Parse a libsvm sparse dataset from given URI.
-
-
-
Method Detail
-
parse
public SparseDataset parse(java.net.URI uri) throws java.io.IOException, java.text.ParseException
Parse a libsvm sparse dataset from given URI.- Throws:
java.io.IOExceptionjava.text.ParseException
-
parse
public SparseDataset parse(java.lang.String name, java.net.URI uri) throws java.io.IOException, java.text.ParseException
Parse a libsvm sparse dataset from given URI.- Parameters:
uri- the URI of data source.- Throws:
java.io.IOExceptionjava.text.ParseException
-
parse
public SparseDataset parse(java.lang.String path) throws java.io.IOException, java.text.ParseException
Parse a libsvm sparse dataset from given file.- Throws:
java.io.IOExceptionjava.text.ParseException
-
parse
public SparseDataset parse(java.lang.String name, java.lang.String path) throws java.io.IOException, java.text.ParseException
Parse a libsvm sparse dataset from given file.- Parameters:
path- the file path of data source.- Throws:
java.io.IOExceptionjava.text.ParseException
-
parse
public SparseDataset parse(java.io.File file) throws java.io.IOException, java.text.ParseException
Parse a libsvm sparse dataset from given file.- Throws:
java.io.IOExceptionjava.text.ParseException
-
parse
public SparseDataset parse(java.lang.String name, java.io.File file) throws java.io.IOException, java.text.ParseException
Parse a libsvm sparse dataset from given file.- Parameters:
file- the file of data source.- Throws:
java.io.IOExceptionjava.text.ParseException
-
parse
public SparseDataset parse(java.lang.String name, java.io.InputStream stream) throws java.io.IOException, java.text.ParseException
Parse a libsvm sparse dataset from an input stream.- Parameters:
name- the name of dataset.stream- the input stream of data.- Throws:
java.io.IOExceptionjava.text.ParseException
-
-
DataMelt 3.0 © DataMelt by jWork.ORG