Skip to content
Snippets Groups Projects
Commit 007da1a9 authored by Joshi's avatar Joshi Committed by Joseph K. Bradley
Browse files

[SPARK-11531][ML] SparseVector error Msg

PySpark SparseVector should have "Found duplicate indices" error message

Author: Joshi <rekhajoshm@gmail.com>
Author: Rekha Joshi <rekhajoshm@gmail.com>

Closes #9525 from rekhajoshm/SPARK-11531.
parent 3b29004d
No related branches found
No related tags found
No related merge requests found
...@@ -528,7 +528,9 @@ class SparseVector(Vector): ...@@ -528,7 +528,9 @@ class SparseVector(Vector):
assert len(self.indices) == len(self.values), "index and value arrays not same length" assert len(self.indices) == len(self.values), "index and value arrays not same length"
for i in xrange(len(self.indices) - 1): for i in xrange(len(self.indices) - 1):
if self.indices[i] >= self.indices[i + 1]: if self.indices[i] >= self.indices[i + 1]:
raise TypeError("indices array must be sorted") raise TypeError(
"Indices %s and %s are not strictly increasing"
% (self.indices[i], self.indices[i + 1]))
def numNonzeros(self): def numNonzeros(self):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment