systemml-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Deron Eriksson (JIRA)" <j...@apache.org>
Subject [jira] [Created] (SYSTEMML-1849) Can't obtain scores from l2-svm-predict.dml using JMLC
Date Thu, 17 Aug 2017 20:15:00 GMT
Deron Eriksson created SYSTEMML-1849:
----------------------------------------

             Summary: Can't obtain scores from l2-svm-predict.dml using JMLC
                 Key: SYSTEMML-1849
                 URL: https://issues.apache.org/jira/browse/SYSTEMML-1849
             Project: SystemML
          Issue Type: Bug
          Components: Compiler, Runtime
            Reporter: Deron Eriksson


Attempting to obtain the {{scores}} variable in {{l2-svm-predict.dml}} using JMLC gives:
{code}
Exception in thread "main" org.apache.sysml.api.DMLException: Non-existent output variable:
scores
	at org.apache.sysml.api.jmlc.ResultVariables.getMatrixBlock(ResultVariables.java:88)
	at org.apache.sysml.api.jmlc.ResultVariables.getMatrix(ResultVariables.java:74)
{code}

This appears to be introduced by https://github.com/apache/systemml/commit/4b81d0dda6583f0ae96eaa7aa5832005ae5fa8a9

Example code:
{code}
	public static void jmlcL2SVM() throws Exception {

		Connection conn = new Connection();

		String dml = conn.readScript("scripts/algorithms/l2-svm.dml");
		PreparedScript l2svm = conn.prepareScript(dml, new String[] { "X", "Y", "fmt", "Log" },
				new String[] { "w", "debug_str" }, false);

		double[][] trainData = new double[150][3];
		for (int i = 0; i < 150; i++) {
			int one = ThreadLocalRandom.current().nextInt(0, 101);
			int two = ThreadLocalRandom.current().nextInt(0, 101);
			int three = ThreadLocalRandom.current().nextInt(0, 101);
			double[] row = new double[] { one, two, three };
			trainData[i] = row;
		}

		l2svm.setMatrix("X", trainData);
		log.debug(displayMatrix(trainData));

		double[][] trainLabels = new double[150][1];
		for (int i = 0; i < 150; i++) {
			int one = ThreadLocalRandom.current().nextInt(1, 3);
			double[] row = new double[] { one };
			trainLabels[i] = row;
		}
		l2svm.setMatrix("Y", trainLabels);
		log.debug(displayMatrix(trainLabels));

		l2svm.setScalar("fmt", "csv");

		l2svm.setScalar("Log", "temp/l2-svm-log.csv");

		ResultVariables l2svmResults = l2svm.executeScript();
		double[][] model = l2svmResults.getMatrix("w");
		log.debug("MODEL:");
		log.debug(displayMatrix(model));
		String debugString = l2svmResults.getString("debug_str");
		log.debug("DEBUG STRING:");
		log.debug(debugString);

		String s = conn.readScript("scripts/algorithms/l2-svm-predict.dml");
		Map<String, String> m = new HashMap<String, String>();
		m.put("$Y", "\"temp/haberman.test.labels.csv\"");
		m.put("$confusion", "\"temp/l2-svm-confusion.csv\"");

		PreparedScript l2svmPredict = conn.prepareScript(s, m, new String[] { "X", "y", "w", "fmt"
},
				new String[] { "scores", "confusion_mat" }, false);

		double[][] testData = new double[150][3];
		for (int i = 0; i < 150; i++) {
			int one = ThreadLocalRandom.current().nextInt(0, 101);
			int two = ThreadLocalRandom.current().nextInt(0, 101);
			int three = ThreadLocalRandom.current().nextInt(0, 101);
			double[] row = new double[] { one, two, three };
			testData[i] = row;
		}
		l2svmPredict.setMatrix("X", testData);

		double[][] testLabels = new double[150][1];
		for (int i = 0; i < 150; i++) {
			int one = ThreadLocalRandom.current().nextInt(1, 3);
			double[] row = new double[] { one };
			testLabels[i] = row;
		}
		l2svmPredict.setMatrix("y", testLabels);

		l2svmPredict.setMatrix("w", model);

		l2svmPredict.setScalar("fmt", "csv");

		ResultVariables l2svmPredictResults = l2svmPredict.executeScript();
		double[][] scores = l2svmPredictResults.getMatrix("scores");
		log.debug("SCORES:");
		log.debug(displayMatrix(scores));

		double[][] confusionMatrix = l2svmPredictResults.getMatrix("confusion_mat");
		log.debug("CONFUSION MATRIX:");
		log.debug(displayMatrix(confusionMatrix));

		conn.close();
	}
{code}





--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message