You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@systemml.apache.org by "Imran Younus (JIRA)" <ji...@apache.org> on 2016/10/05 17:02:20 UTC
[jira] [Created] (SYSTEMML-1013) RuntimeError: maximum recursion
depth exceeded, when using python API
Imran Younus created SYSTEMML-1013:
--------------------------------------
Summary: RuntimeError: maximum recursion depth exceeded, when using python API
Key: SYSTEMML-1013
URL: https://issues.apache.org/jira/browse/SYSTEMML-1013
Project: SystemML
Issue Type: Bug
Components: APIs
Environment: Linux mint (laptop). Spark 1.6.2
Reporter: Imran Younus
I'm trying to implement non-negative matrix factorization using python API. Here is the code that I'm running:
{code}
from pyspark.sql import SQLContext
import systemml as sml
import numpy as np
sqlContext = SQLContext(sc)
sml.setSparkContext(sc)
m = 2000
n = 2400
k = 10
V = sml.matrix(np.random.rand(2034, 2398))
W = sml.matrix(np.random.rand(m, k))
H = sml.matrix(np.random.rand(k, n))
max_iters = 500
for i in range(max_iters):
H = H * (W.transpose().dot(V))/(W.transpose().dot(W.dot(H)) + 1e-9)
W = W * (V.dot(H.transpose()))/(W.dot(H.dot(H.transpose())) + 1e-9)
res = H.toNumPyArray()
{code}
If the number of iterations are smaller, the code runs fine. But when I change the number of iteration to, say, 500, I get the following error:
{code}
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-1-28769ccee510> in <module>()
18 W = W * (V.dot(H.transpose()))/(W.dot(H.dot(H.transpose())) + 1e-9)
19
---> 20 res = H.toNumPyArray()
/home/iyounus/git/incubator-systemml/src/main/python/systemml/defmatrix.pyc in toNumPyArray(self)
455 """
456 if self.data is None:
--> 457 self.eval()
458 if isinstance(self.data, DataFrame):
459 self.data = self.data.toPandas().as_matrix()
/home/iyounus/git/incubator-systemml/src/main/python/systemml/defmatrix.pyc in eval(self, outputDF)
440 This is a convenience function that calls the global eval method
441 """
--> 442 eval([self], outputDF=False)
443
444 def toPandas(self):
/home/iyounus/git/incubator-systemml/src/main/python/systemml/defmatrix.pyc in eval(outputs, outputDF, execute)
300 reset()
301 outputs = convertOutputsToList(outputs)
--> 302 matrix.script.scriptString = performDFS(outputs, execute)
303 if not execute:
304 resetOutputFlag(outputs)
/home/iyounus/git/incubator-systemml/src/main/python/systemml/defmatrix.pyc in performDFS(outputs, execute)
105 for m in outputs:
106 m.output = True
--> 107 m._visit(execute=execute)
108 return ''.join(matrix.dml)
109
/home/iyounus/git/incubator-systemml/src/main/python/systemml/defmatrix.pyc in _visit(self, execute)
507 # Traverse the AST
508 for m in self.op.inputs:
--> 509 m._visit(execute=execute)
510 self.op._visit(execute=execute)
511 else:
... last 1 frames repeated, from the frame below ...
/home/iyounus/git/incubator-systemml/src/main/python/systemml/defmatrix.pyc in _visit(self, execute)
507 # Traverse the AST
508 for m in self.op.inputs:
--> 509 m._visit(execute=execute)
510 self.op._visit(execute=execute)
511 else:
RuntimeError: maximum recursion depth exceeded
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)