Skip to content

Commit b3796b7

Browse files
committed
a dMatrix for testing
1 parent e995228 commit b3796b7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

jvm-packages/xgboost4j/src/test/java/ml/dmlc/xgboost4j/java/BoosterImplTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,18 @@ class InplacePredictThread extends Thread {
9595
float[][] testX;
9696
int test_rows;
9797
int features;
98+
DMatrix dMatrix;
9899
float[][] true_predicts;
99100
Booster booster;
100101
Random rng = new Random();
101102
int n_preds = 100;
102103

103-
public InplacePredictThread(int n, Booster booster, float[][] testX, int test_rows, int features, float[][] true_predicts) {
104+
public InplacePredictThread(int n, Booster booster, float[][] testX, int test_rows, int features, DMatrix dMatrix, float[][] true_predicts) {
104105
this.thread_num = n;
105106
this.booster = booster;
106107
this.testX = testX;
107108
this.test_rows = test_rows;
109+
this.dMatrix = dMatrix;
108110
this.features = features;
109111
this.true_predicts = true_predicts;
110112
}
@@ -120,7 +122,7 @@ public void run() {
120122
int r = this.rng.nextInt(this.test_rows);
121123

122124
// In-place predict a single random row
123-
float[][] predictions = booster.inplace_predict(this.testX[r], 1, this.features);
125+
float[][] predictions = booster.inplace_predict(this.testX[r], 1, this.features, this.dMatrix);
124126

125127
// Confirm results as expected
126128
if (predictions[0][0] != this.true_predicts[r][0]) {

0 commit comments

Comments
 (0)