Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/vowpal_wabbit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/test/java/vw/VWScorerTest.java')
-rw-r--r--java/src/test/java/vw/VWScorerTest.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/java/src/test/java/vw/VWScorerTest.java b/java/src/test/java/vw/VWScorerTest.java
index 740fefce..05b6ae61 100644
--- a/java/src/test/java/vw/VWScorerTest.java
+++ b/java/src/test/java/vw/VWScorerTest.java
@@ -3,6 +3,8 @@ package vw;
import org.junit.BeforeClass;
import org.junit.Test;
+import java.io.IOException;
+
import static org.junit.Assert.assertEquals;
/**
@@ -12,19 +14,23 @@ public class VWScorerTest {
private static VWScorer scorer;
@BeforeClass
- public static void setup() {
- scorer = new VWScorer("-i src/test/resources/house.model --quiet -t");
+ public static void setup() throws IOException, InterruptedException {
+ // Since we want this test to continue to work between VW changes, we can't store the model
+ // Instead, we'll make a new model for each test
+ String vwModel = "target/house.model";
+ Runtime.getRuntime().exec("../vowpalwabbit/vw -d src/test/resources/house.vw -f " + vwModel).waitFor();
+ scorer = new VWScorer("--quiet -t -i " + vwModel);
}
@Test
public void testBlank() {
float prediction = scorer.getPrediction("| ");
- assertEquals(0.07496, prediction, 0.00001);
+ assertEquals(0.075, prediction, 0.001);
}
@Test
public void testLine() {
float prediction = scorer.getPrediction("| price:0.23 sqft:0.25 age:0.05 2006");
- assertEquals(0.118467, prediction, 0.00001);
+ assertEquals(0.118, prediction, 0.001);
}
}