Matthias, thanks for replying in such short notice. A couple of things I wanted to know from your response:
1. conn.convertToDoubleMatrix(conn.readScript(model), rows, cols, "csv"). This takes in an InputStream and conn.readScript does not return that. Which API should I use instead? 2. pstmt = conn.prepareScript(conn.readScript(dml), new String[] { "w", "X" }, new String[] { "predicted_y" }, false): is the code I posted and I don't understand how it differs from what you said on point 2: "So please change it as follows: conn.prepareScript(conn.readScript(dml), new String[] {"w", "X"}, new String[] {"predicted_y"}, " Thanks! On Fri, Aug 25, 2017 at 4:06 PM Matthias Boehm <mboe...@googlemail.com> wrote: > thanks for reaching out - let us quickly go through these issues to > demystify them: > > 1) Matrix text formats: Apart from binary representations, we support the > following text matrix formats: "mm" (matrix market), "text" (like matrix > market but without the meta data header), and "csv". The sparse "text" > format is our default. You had a csv representation but (without specifying > the format) you tried to read it as "text" which failed on parsing the > first column as row index. You can use something like that > > conn.convertToDoubleMatrix(conn.readScript(model), rows, cols, "csv") > > 2) Parameter binding: Furthermore, note that matrix inputs (and any other > inputs) should be bound to the left-hand-side variable name. So please > change it as follows > > conn.prepareScript(conn.readScript(dml), new String[] {"w", "X"}, new > String[] {"predicted_y"}, > > 3) Model reuse: In order to ensure low-latency scoring even for relatively > large models, you might want to mark your model as reused input. You can do > that as follows while setting up your prepared statement. This converts the > model just once and reuses the internal representation over multiple > invocations of executeScript. > > pstmt.setMatrix("w", wData, true); > > > Regards, > Matthias > > On Fri, Aug 25, 2017 at 9:48 AM, Federico Wachs < > federico.wa...@sqlstream.com> wrote: > > > 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.wa...@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 > > > -- Federico Wachs | sqlstream | +54 911 5748 5048