You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@systemml.apache.org by Federico Wachs <fe...@sqlstream.com> on 2017/08/25 14:02:20 UTC

JMLC and l2-svm.dml

Hi all,

I've been able to follow the steps showed here
<http://apache.github.io/systemml/standalone-guide#training-and-testing-the-model>
and
I want to use the created model from JMLC.

But when I try to load the model like this:






*String dml =
"/home/fwachs/work/systemml/scripts/algorithms/l2-svm-predict.dml";String
model = "/home/fwachs/Downloads/l2-svm-model.csv";Connection conn = new
Connection();*


*PreparedScript pstmt = conn.prepareScript(conn.readScript(dml), new
String[] { "model", "X" }, new String[] { "predicted_y" },
false);double[][] W = conn.convertToDoubleMatrix(conn.readScript(model), 1,
1);System.out.println(W);*

I get the following error:

17/08/25 07:01:02 WARN rewrite.RewriteRemovePersistentReadWrite:
Non-registered persistent read of variable 'w' (line 44).
Exception in thread "main" java.io.IOException: Matrix cell [0,0] out of
overall matrix range [1:1,1:1].
at
org.apache.sysml.runtime.io.ReaderTextCell.readRawTextCellMatrixFromInputStream(ReaderTextCell.java:236)
at
org.apache.sysml.runtime.io.ReaderTextCell.readMatrixFromInputStream(ReaderTextCell.java:90)
at
org.apache.sysml.api.jmlc.Connection.convertToDoubleMatrix(Connection.java:413)
at
org.apache.sysml.api.jmlc.Connection.convertToDoubleMatrix(Connection.java:382)
at
org.apache.sysml.api.jmlc.Connection.convertToDoubleMatrix(Connection.java:368)
at com.sqlstream.plugin.systemml.SystemmlUdx.main(SystemmlUdx.java:65)
Caused by: java.lang.NumberFormatException: For input string:
"-2.0851945931025258"

It seems the csv generated is not a matrix at all, since it contains the
following content:

-2.0851945931025258
6.006153060967643
3.094544228625507
-0.43162666659496396
1.0
0
0
4.0


Any ideas? I am so stuck on this...

Thanks,
-- 
Federico Wachs | sqlstream | +54 911 5748 5048

Re: JMLC and l2-svm.dml

Posted by Federico Wachs <fe...@sqlstream.com>.
Nevermind. I actually found out that I could change the output to write to
the model file from csv to text which actually writes the matrix.

Thanks,

On Fri, Aug 25, 2017 at 11:02 AM Federico Wachs <
federico.wachs@sqlstream.com> wrote:

> Hi all,
>
> I've been able to follow the steps showed here
> <http://apache.github.io/systemml/standalone-guide#training-and-testing-the-model> and
> I want to use the created model from JMLC.
>
> But when I try to load the model like this:
>
>
>
>
>
>
> *String dml =
> "/home/fwachs/work/systemml/scripts/algorithms/l2-svm-predict.dml";String
> model = "/home/fwachs/Downloads/l2-svm-model.csv";Connection conn = new
> Connection();*
>
>
> *PreparedScript pstmt = conn.prepareScript(conn.readScript(dml), new
> String[] { "model", "X" }, new String[] { "predicted_y" },
> false);double[][] W = conn.convertToDoubleMatrix(conn.readScript(model), 1,
> 1);System.out.println(W);*
>
> I get the following error:
>
> 17/08/25 07:01:02 WARN rewrite.RewriteRemovePersistentReadWrite:
> Non-registered persistent read of variable 'w' (line 44).
> Exception in thread "main" java.io.IOException: Matrix cell [0,0] out of
> overall matrix range [1:1,1:1].
> at
> org.apache.sysml.runtime.io.ReaderTextCell.readRawTextCellMatrixFromInputStream(ReaderTextCell.java:236)
> at
> org.apache.sysml.runtime.io.ReaderTextCell.readMatrixFromInputStream(ReaderTextCell.java:90)
> at
> org.apache.sysml.api.jmlc.Connection.convertToDoubleMatrix(Connection.java:413)
> at
> org.apache.sysml.api.jmlc.Connection.convertToDoubleMatrix(Connection.java:382)
> at
> org.apache.sysml.api.jmlc.Connection.convertToDoubleMatrix(Connection.java:368)
> at com.sqlstream.plugin.systemml.SystemmlUdx.main(SystemmlUdx.java:65)
> Caused by: java.lang.NumberFormatException: For input string:
> "-2.0851945931025258"
>
> It seems the csv generated is not a matrix at all, since it contains the
> following content:
>
> -2.0851945931025258
> 6.006153060967643
> 3.094544228625507
> -0.43162666659496396
> 1.0
> 0
> 0
> 4.0
>
>
> Any ideas? I am so stuck on this...
>
> Thanks,
> --
> Federico Wachs | sqlstream | +54 911 5748 5048
>
-- 
Federico Wachs | sqlstream | +54 911 5748 5048