MCPcopy Index your code
hub / github.com/WinVector/Logistic / SparseExampleRow

Class SparseExampleRow

src/com/winvector/opt/impl/SparseExampleRow.java:5–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3import com.winvector.opt.def.ExampleRow;
4
5public final class SparseExampleRow implements ExampleRow {
6 private final int category;
7 private final double wt;
8 private final SparseSemiVec v;
9
10 public SparseExampleRow(final SparseSemiVec v, final double weight, final int category) {
11 this.category = category;
12 wt = weight;
13 this.v = v;
14 }
15
16
17 @Override
18 public int getNIndices() {
19 return v.getNIndices();
20 }
21
22 @Override
23 public int getKthIndex(final int ii) {
24 return v.getKthIndex(ii);
25 }
26
27 @Override
28 public double getKthValue(final int ii) {
29 return v.getKthValue(ii);
30 }
31
32 @Override
33 public int category() {
34 return category;
35 }
36
37 @Override
38 public double weight() {
39 return wt;
40 }
41
42 @Override
43 public String toString() {
44 return v.toString() + "(" + wt +"): " + category;
45 }
46}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected