forked from bwaldvogel/liblinear-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblem.java
More file actions
50 lines (44 loc) · 1.37 KB
/
Copy pathProblem.java
File metadata and controls
50 lines (44 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package liblinear;
/**
* Problem describes the problem
*
* <pre>
* 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,?)
* </pre>
*/
public class Problem {
/** the number of training data */
public int l;
/** the number of features (including the bias feature if bias >= 0) */
public int n;
/** an array containing the target values */
public int[] y;
/** array of sparse feature nodes */
public FeatureNode[][] x;
/**
* If bias >= 0, we assume that one additional feature is added
* to the end of each data instance
*/
public double bias;
}