Search in sources :

Example 16 with TestConfiguration

use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.

the class TransformAndApplyTest method setUp.

@Override
public void setUp() {
    TestUtils.clearAssertionInformation();
    addTestConfiguration(TEST_NAME1, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] { "R1", "R2" }));
}
Also used : TestConfiguration(org.apache.sysml.test.integration.TestConfiguration)

Example 17 with TestConfiguration

use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.

the class TransformFrameApplyTest method setUp.

@Override
public void setUp() {
    TestUtils.clearAssertionInformation();
    addTestConfiguration(TEST_NAME1, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] { "y" }));
}
Also used : TestConfiguration(org.apache.sysml.test.integration.TestConfiguration)

Example 18 with TestConfiguration

use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.

the class TransformReadMetaTest method setUp.

@Override
public void setUp() {
    TestUtils.clearAssertionInformation();
    addTestConfiguration(TEST_NAME1, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] { "M1, M" }));
    addTestConfiguration(TEST_NAME2, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME2, new String[] { "M1, M" }));
}
Also used : TestConfiguration(org.apache.sysml.test.integration.TestConfiguration)

Example 19 with TestConfiguration

use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.

the class BivariateCategoricalCategoricallTest method testOddsRatio.

@Test
public void testOddsRatio() {
    TestConfiguration config = getTestConfiguration(TEST_ODDS_RATIO);
    config.addVariable("rows", rows);
    loadTestConfiguration(config);
    /* This is for running the junit test the new way, i.e., construct the arguments directly */
    String CC_HOME = SCRIPT_DIR + TEST_DIR;
    fullDMLScriptName = CC_HOME + TEST_ODDS_RATIO + ".dml";
    programArgs = new String[] { "-args", input("A"), Integer.toString(rows), input("B"), output("oddsRatio"), output("sigma"), output("leftConf"), output("rightConf"), output("sigmasAway") // output("chiSquared"),
    // output(degFreedom"),
    // output("pValue"),
    // output("cramersV")
    };
    fullRScriptName = CC_HOME + TEST_ODDS_RATIO + ".R";
    rCmd = "Rscript" + " " + fullRScriptName + " " + inputDir() + " " + expectedDir();
    // current test works only for 2x2 contingency tables => #categories must be 2
    int numCat = 2;
    double[][] A = getRandomMatrix(rows, 1, 1, numCat, 1, System.currentTimeMillis());
    double[][] B = getRandomMatrix(rows, 1, 1, numCat, 1, System.currentTimeMillis() + 1);
    TestUtils.round(A);
    TestUtils.round(B);
    writeInputMatrix("A", A, true);
    writeInputMatrix("B", B, true);
    runTest(true, false, null, -1);
    runRScript(true);
    for (String file : config.getOutputFiles()) {
        /* NOte that some files do not contain matrix, but just a single scalar value inside */
        HashMap<CellIndex, Double> dmlfile;
        HashMap<CellIndex, Double> rfile;
        if (file.endsWith(".scalar")) {
            file = file.replace(".scalar", "");
            dmlfile = readDMLScalarFromHDFS(file);
            rfile = readRScalarFromFS(file);
        } else {
            dmlfile = readDMLMatrixFromHDFS(file);
            rfile = readRMatrixFromFS(file);
        }
        TestUtils.compareMatrices(dmlfile, rfile, eps, file + "-DML", file + "-R");
    }
}
Also used : CellIndex(org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex) TestConfiguration(org.apache.sysml.test.integration.TestConfiguration) Test(org.junit.Test)

Example 20 with TestConfiguration

use of org.apache.sysml.test.integration.TestConfiguration in project incubator-systemml by apache.

the class BivariateOrdinalOrdinalTest method testOrdinalOrdinalWithWeights.

@Test
public void testOrdinalOrdinalWithWeights() {
    TestConfiguration config = getTestConfiguration(TEST_ORDINAL_ORDINAL_WEIGHTS);
    config.addVariable("rows", rows);
    loadTestConfiguration(config);
    /* This is for running the junit test the new way, i.e., construct the arguments directly */
    String OO_HOME = SCRIPT_DIR + TEST_DIR;
    fullDMLScriptName = OO_HOME + TEST_ORDINAL_ORDINAL_WEIGHTS + ".dml";
    programArgs = new String[] { "-args", input("A"), Integer.toString(rows), input("B"), input("WM"), output("Spearman") };
    fullRScriptName = OO_HOME + TEST_ORDINAL_ORDINAL_WEIGHTS + ".R";
    rCmd = "Rscript" + " " + fullRScriptName + " " + inputDir() + " " + expectedDir();
    double[][] A = getRandomMatrix(rows, 1, 1, ncatA, 1, System.currentTimeMillis());
    double[][] B = getRandomMatrix(rows, 1, 1, ncatB, 1, System.currentTimeMillis());
    double[][] WM = getRandomMatrix(rows, 1, 1, maxW, 1, System.currentTimeMillis());
    TestUtils.floor(A);
    TestUtils.floor(B);
    TestUtils.floor(WM);
    writeInputMatrix("A", A, true);
    writeInputMatrix("B", B, true);
    writeInputMatrix("WM", WM, true);
    runTest(true, false, null, -1);
    runRScript(true);
    for (String file : config.getOutputFiles()) {
        /* NOte that some files do not contain matrix, but just a single scalar value inside */
        HashMap<CellIndex, Double> dmlfile;
        HashMap<CellIndex, Double> rfile;
        if (file.endsWith(".scalar")) {
            file = file.replace(".scalar", "");
            dmlfile = readDMLScalarFromHDFS(file);
            rfile = readRScalarFromFS(file);
        } else {
            dmlfile = readDMLMatrixFromHDFS(file);
            rfile = readRMatrixFromFS(file);
        }
        TestUtils.compareMatrices(dmlfile, rfile, eps, file + "-DML", file + "-R");
    }
}
Also used : CellIndex(org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex) TestConfiguration(org.apache.sysml.test.integration.TestConfiguration) Test(org.junit.Test)

Aggregations

TestConfiguration (org.apache.sysml.test.integration.TestConfiguration)866 Test (org.junit.Test)299 CellIndex (org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex)201 RUNTIME_PLATFORM (org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM)171 MatrixCharacteristics (org.apache.sysml.runtime.matrix.MatrixCharacteristics)50 IOException (java.io.IOException)18 MatrixBlock (org.apache.sysml.runtime.matrix.data.MatrixBlock)14 Modulus (org.apache.sysml.runtime.functionobjects.Modulus)9 HashMap (java.util.HashMap)8 FrameBlock (org.apache.sysml.runtime.matrix.data.FrameBlock)8 DMLException (org.apache.sysml.api.DMLException)6 Random (java.util.Random)5 ValueType (org.apache.sysml.parser.Expression.ValueType)5 Date (java.util.Date)3 BufferedReader (java.io.BufferedReader)2 FileReader (java.io.FileReader)2 Connection (org.apache.sysml.api.jmlc.Connection)2 DMLConfig (org.apache.sysml.conf.DMLConfig)2 DMLProgram (org.apache.sysml.parser.DMLProgram)2 DMLTranslator (org.apache.sysml.parser.DMLTranslator)2