Package de.bwaldvogel.liblinear
Class Problem
java.lang.Object
de.bwaldvogel.liblinear.Problem
public class Problem
extends java.lang.Object
Describes the problem
For example, if we have the following training data:
LABEL ATTR1 ATTR2 ATTR3 ATTR4 ATTR5
----- ----- ----- ----- ----- -----
1 0 0.1 0.2 0 0
2 0 0.1 0.3 -1.2 0
1 0.4 0 0 0 0
2 0 0.1 0 1.4 0.5
3 -0.1 -0.2 0.1 1.1 0.1
and bias = 1, then the components of problem are:
l = 5
n = 6
y -> 1 2 1 2 3
x -> [ ] -> (2,0.1) (3,0.2) (6,1) (-1,?)
[ ] -> (2,0.1) (3,0.3) (4,-1.2) (6,1) (-1,?)
[ ] -> (1,0.4) (6,1) (-1,?)
[ ] -> (2,0.1) (4,1.4) (5,0.5) (6,1) (-1,?)
[ ] -> (1,-0.1) (2,-0.2) (3,0.1) (4,1.1) (5,0.1) (6,1) (-1,?)
-
Field Summary
Fields Modifier and Type Field Description doublebiasIf bias >= 0, we assume that one additional feature is added to the end of each data instanceintlthe number of training dataintnthe number of features (including the bias feature if bias >= 0)Feature[][]xarray of sparse feature nodesdouble[]yan array containing the target values -
Constructor Summary
Constructors Constructor Description Problem() -
Method Summary
Modifier and Type Method Description static ProblemreadFromFile(java.io.File file, double bias)Deprecated.usereadFromFile(Path, double)insteadstatic ProblemreadFromFile(java.io.File file, java.nio.charset.Charset charset, double bias)Deprecated.usereadFromFile(Path, Charset, double)insteadstatic ProblemreadFromFile(java.nio.file.Path path, double bias)static ProblemreadFromFile(java.nio.file.Path path, java.nio.charset.Charset charset, double bias)static ProblemreadFromStream(java.io.InputStream inputStream, double bias)static ProblemreadFromStream(java.io.InputStream inputStream, java.nio.charset.Charset charset, double bias)
-
Field Details
-
l
public int lthe number of training data -
n
public int nthe number of features (including the bias feature if bias >= 0) -
y
public double[] yan array containing the target values -
x
array of sparse feature nodes -
bias
public double biasIf bias >= 0, we assume that one additional feature is added to the end of each data instance
-
-
Constructor Details
-
Problem
public Problem()
-
-
Method Details
-
readFromFile
public static Problem readFromFile(java.io.File file, double bias) throws java.io.IOException, InvalidInputDataExceptionDeprecated.usereadFromFile(Path, double)instead- Throws:
java.io.IOExceptionInvalidInputDataException
-
readFromFile
public static Problem readFromFile(java.nio.file.Path path, double bias) throws java.io.IOException, InvalidInputDataException- Throws:
java.io.IOExceptionInvalidInputDataException
-
readFromFile
public static Problem readFromFile(java.io.File file, java.nio.charset.Charset charset, double bias) throws java.io.IOException, InvalidInputDataExceptionDeprecated.usereadFromFile(Path, Charset, double)instead- Throws:
java.io.IOExceptionInvalidInputDataException
-
readFromFile
public static Problem readFromFile(java.nio.file.Path path, java.nio.charset.Charset charset, double bias) throws java.io.IOException, InvalidInputDataException- Throws:
java.io.IOExceptionInvalidInputDataException
-
readFromStream
public static Problem readFromStream(java.io.InputStream inputStream, double bias) throws java.io.IOException, InvalidInputDataException- Throws:
java.io.IOExceptionInvalidInputDataException
-
readFromStream
public static Problem readFromStream(java.io.InputStream inputStream, java.nio.charset.Charset charset, double bias) throws java.io.IOException, InvalidInputDataException- Throws:
java.io.IOExceptionInvalidInputDataException
-