You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemml.apache.org by mb...@apache.org on 2018/04/08 19:49:35 UTC
[2/2] systemml git commit: [MINOR] Cleanup flaky l2svm application
test (inconsistent tolerance)
[MINOR] Cleanup flaky l2svm application test (inconsistent tolerance)
Project: http://git-wip-us.apache.org/repos/asf/systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/159522a1
Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/159522a1
Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/159522a1
Branch: refs/heads/master
Commit: 159522a1f08869c034ae6544be749e2695ab997a
Parents: 93506b2
Author: Matthias Boehm <mb...@gmail.com>
Authored: Sun Apr 8 12:50:36 2018 -0700
Committer: Matthias Boehm <mb...@gmail.com>
Committed: Sun Apr 8 12:50:36 2018 -0700
----------------------------------------------------------------------
.../integration/applications/L2SVMTest.java | 71 +++++++++-----------
1 file changed, 33 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/systemml/blob/159522a1/src/test/java/org/apache/sysml/test/integration/applications/L2SVMTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/sysml/test/integration/applications/L2SVMTest.java b/src/test/java/org/apache/sysml/test/integration/applications/L2SVMTest.java
index 35afb7b..eae542c 100644
--- a/src/test/java/org/apache/sysml/test/integration/applications/L2SVMTest.java
+++ b/src/test/java/org/apache/sysml/test/integration/applications/L2SVMTest.java
@@ -33,7 +33,6 @@ import org.apache.sysml.test.utils.TestUtils;
public abstract class L2SVMTest extends AutomatedTestBase
{
-
protected final static String TEST_DIR = "applications/l2svm/";
protected final static String TEST_NAME = "L2SVM";
protected String TEST_CLASS_DIR = TEST_DIR + L2SVMTest.class.getSimpleName() + "/";
@@ -41,7 +40,7 @@ public abstract class L2SVMTest extends AutomatedTestBase
protected int numRecords, numFeatures;
protected double sparsity;
protected boolean intercept;
-
+
public L2SVMTest(int rows, int cols, double sp, boolean intercept) {
numRecords = rows;
numFeatures = cols;
@@ -50,35 +49,34 @@ public abstract class L2SVMTest extends AutomatedTestBase
}
@Parameters
- public static Collection<Object[]> data() {
- Object[][] data = new Object[][] {
- //sparse tests (sparsity=0.01)
- {100, 50, 0.01, false}, {1000, 500, 0.01, false}, {10000, 750, 0.01, false}, {10000, 750, 0.01, true}, {100000, 1000, 0.01, false},
- //dense tests (sparsity=0.7)
- {100, 50, 0.7, false}, {1000, 500, 0.7, false}, {1000, 500, 0.7, true}, {10000, 750, 0.7, false} };
- return Arrays.asList(data);
- }
+ public static Collection<Object[]> data() {
+ return Arrays.asList(new Object[][] {
+ //sparse tests (sparsity=0.01)
+ {100, 50, 0.01, false}, {1000, 500, 0.01, false}, {10000, 750, 0.01, false}, {10000, 750, 0.01, true}, {100000, 1000, 0.01, false},
+ //dense tests (sparsity=0.7)
+ {100, 50, 0.7, false}, {1000, 500, 0.7, false}, {1000, 500, 0.7, true}, {10000, 750, 0.7, false} });
+ }
@Override
public void setUp() {
- addTestConfiguration(TEST_CLASS_DIR, TEST_NAME);
+ addTestConfiguration(TEST_CLASS_DIR, TEST_NAME);
}
protected void testL2SVM(ScriptType scriptType)
{
- System.out.println("------------ BEGIN " + TEST_NAME + " " + scriptType + " TEST WITH {" + numRecords + ", " + numFeatures
- + ", " + sparsity + ", " + intercept + "} ------------");
+ System.out.println("------------ BEGIN " + TEST_NAME + " " + scriptType
+ + " TEST WITH {" + numRecords + ", " + numFeatures
+ + ", " + sparsity + ", " + intercept + "} ------------");
this.scriptType = scriptType;
-
int rows = numRecords;
- int cols = numFeatures;
- double epsilon = 1.0e-8;
- double lambda = 1.0;
- int maxiterations = 3;
- int maxNumberOfMRJobs = 21;
-
- getAndLoadTestConfiguration(TEST_NAME);
-
+ int cols = numFeatures;
+ double epsilon = 1e-10;
+ double lambda = 1.0;
+ int maxiterations = 3;
+ int maxNumberOfMRJobs = 21;
+
+ getAndLoadTestConfiguration(TEST_NAME);
+
List<String> proArgs = new ArrayList<String>();
if (scriptType == ScriptType.PYDML) {
proArgs.add("-python");
@@ -94,26 +92,23 @@ public abstract class L2SVMTest extends AutomatedTestBase
proArgs.add("model=" + output("w"));
proArgs.add("Log=" + output("Log"));
programArgs = proArgs.toArray(new String[proArgs.size()]);
-
fullDMLScriptName = getScript();
-
rCmd = getRCmd(inputDir(), (intercept ? Integer.toString(1) : Integer.toString(0)), Double.toString(epsilon),
Double.toString(lambda), Integer.toString(maxiterations), expectedDir());
- double[][] X = getRandomMatrix(rows, cols, 0, 1, sparsity, -1);
- double[][] Y = getRandomMatrix(rows, 1, -1, 1, 1, -1);
- for(int i=0; i<rows; i++)
- Y[i][0] = (Y[i][0] > 0) ? 1 : -1;
-
- writeInputMatrixWithMTD("X", X, true);
- writeInputMatrixWithMTD("Y", Y, true);
-
- runTest(true, EXCEPTION_NOT_EXPECTED, null, maxNumberOfMRJobs);
-
+ double[][] X = getRandomMatrix(rows, cols, 0, 1, sparsity, -1);
+ double[][] Y = getRandomMatrix(rows, 1, -1, 1, 1, -1);
+ for(int i=0; i<rows; i++)
+ Y[i][0] = (Y[i][0] > 0) ? 1 : -1;
+
+ writeInputMatrixWithMTD("X", X, true);
+ writeInputMatrixWithMTD("Y", Y, true);
+ runTest(true, EXCEPTION_NOT_EXPECTED, null, maxNumberOfMRJobs);
+
runRScript(true);
-
+
HashMap<CellIndex, Double> wR = readRMatrixFromFS("w");
- HashMap<CellIndex, Double> wSYSTEMML= readDMLMatrixFromHDFS("w");
- TestUtils.compareMatrices(wR, wSYSTEMML, Math.pow(10, -12), "wR", "wSYSTEMML");
- }
+ HashMap<CellIndex, Double> wSYSTEMML= readDMLMatrixFromHDFS("w");
+ TestUtils.compareMatrices(wR, wSYSTEMML, epsilon, "wR", "wSYSTEMML");
+ }
}