Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
None
-
None
Description
from pyspark.sql import SQLContext
from systemml.mllearn import LinearRegression
sqlCtx = SQLContext(sc)
regr = LinearRegression(sqlCtx)
- Train the model using the training sets
regr.fit(diabetes_X_train, diabetes_y_train)
regr.predict(diabetes_X_test)
Traceback (most recent call last):
File "/gpfs/fs01/user/s97f-e8039831bd320d-6262032d0bcc/.local/lib/python2.7/site-packages/systemml/mllearn/estimators.py", line 170, in predict
retNumPy = self.decode(convertToNumPyArr(self.sc, self.model.transform(convertToMatrixBlock(self.sc, X))))
File "/usr/local/src/spark160master/spark/python/lib/py4j-0.9-src.zip/py4j/java_gateway.py", line 813, in _call_
answer, self.gateway_client, self.target_id, self.name)
File "/usr/local/src/spark160master/spark/python/pyspark/sql/utils.py", line 45, in deco
return f(*a, **kw)
File "/usr/local/src/spark160master/spark/python/lib/py4j-0.9-src.zip/py4j/protocol.py", line 308, in get_return_value
format(target_id, ".", name), value)
Py4JJavaError: An error occurred while calling o132.transform.
: org.apache.sysml.api.mlcontext.MLContextException: Exception when executing script
at org.apache.sysml.api.mlcontext.MLContext.execute(MLContext.java:307)
at org.apache.sysml.api.mlcontext.MLContext.execute(MLContext.java:276)
at org.apache.sysml.api.ml.BaseSystemMLRegressorModel$class.baseTransform(BaseSystemMLRegressor.scala:65)
at org.apache.sysml.api.ml.LinearRegressionModel.baseTransform(LinearRegression.scala:83)
at org.apache.sysml.api.ml.LinearRegressionModel.transform(LinearRegression.scala:95)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:507)
at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:231)
at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:381)
at py4j.Gateway.invoke(Gateway.java:259)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.GatewayConnection.run(GatewayConnection.java:209)
at java.lang.Thread.run(Thread.java:785)
Caused by: org.apache.sysml.api.mlcontext.MLContextException: Exception occurred while validating script
at org.apache.sysml.api.mlcontext.ScriptExecutor.validateScript(ScriptExecutor.java:553)
at org.apache.sysml.api.mlcontext.ScriptExecutor.execute(ScriptExecutor.java:307)
at org.apache.sysml.api.mlcontext.MLContext.execute(MLContext.java:299)
... 15 more
Caused by: org.apache.sysml.parser.LanguageException: Invalid Parameters : ERROR: null – line 206, column 12 – Mismatch in matrix dimensions of parameters for function TABLE
at org.apache.sysml.parser.Expression.raiseValidateError(Expression.java:556)
at org.apache.sysml.parser.BuiltinFunctionExpression.checkMatchingDimensions(BuiltinFunctionExpression.java:1447)
at org.apache.sysml.parser.BuiltinFunctionExpression.checkMatchingDimensions(BuiltinFunctionExpression.java:1428)
at org.apache.sysml.parser.BuiltinFunctionExpression.validateExpression(BuiltinFunctionExpression.java:677)
at org.apache.sysml.parser.StatementBlock.validate(StatementBlock.java:567)
at org.apache.sysml.parser.IfStatementBlock.validate(IfStatementBlock.java:70)
at org.apache.sysml.parser.IfStatementBlock.validate(IfStatementBlock.java:70)
at org.apache.sysml.parser.IfStatementBlock.validate(IfStatementBlock.java:77)
at org.apache.sysml.parser.IfStatementBlock.validate(IfStatementBlock.java:70)
at org.apache.sysml.parser.DMLTranslator.validateParseTree(DMLTranslator.java:140)
at org.apache.sysml.api.mlcontext.ScriptExecutor.validateScript(ScriptExecutor.java:551)
... 17 more
UnboundLocalErrorTraceback (most recent call last)
<ipython-input-51-d88481946cc5> in <module>()
----> 1 regr.predict(diabetes_X_test)
/gpfs/fs01/user/s97f-e8039831bd320d-6262032d0bcc/.local/lib/python2.7/site-packages/systemml/mllearn/estimators.pyc in predict(self, X)
172 traceback.print_exc()
173 if isinstance(X, np.ndarray):
--> 174 return retNumPy
175 else:
176 return retNumPy # TODO: Convert to Pandas
UnboundLocalError: local variable 'retNumPy' referenced before assignment
Thanks, Felix. You are right. Closing this in favor of
SYSTEMML-1200