From a5d05819afcc9b19aeae4817d842205f32b34335 Mon Sep 17 00:00:00 2001 From: "Joseph K. Bradley" Date: Mon, 20 Jul 2015 16:49:55 -0700 Subject: [SPARK-9198] [MLLIB] [PYTHON] Fixed typo in pyspark sparsevector doc tests Several places in the PySpark SparseVector docs have one defined as: ``` SparseVector(4, [2, 4], [1.0, 2.0]) ``` The index 4 goes out of bounds (but this is not checked). CC: mengxr Author: Joseph K. Bradley Closes #7541 from jkbradley/sparsevec-doc-typo-fix and squashes the following commits: c806a65 [Joseph K. Bradley] fixed doc test e2dcb23 [Joseph K. Bradley] Fixed typo in pyspark sparsevector doc tests --- python/pyspark/mllib/linalg.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/pyspark/mllib/linalg.py b/python/pyspark/mllib/linalg.py index 529bd75894..334dc8e38b 100644 --- a/python/pyspark/mllib/linalg.py +++ b/python/pyspark/mllib/linalg.py @@ -566,7 +566,7 @@ class SparseVector(Vector): 25.0 >>> a.dot(array.array('d', [1., 2., 3., 4.])) 22.0 - >>> b = SparseVector(4, [2, 4], [1.0, 2.0]) + >>> b = SparseVector(4, [2], [1.0]) >>> a.dot(b) 0.0 >>> a.dot(np.array([[1, 1], [2, 2], [3, 3], [4, 4]])) @@ -624,11 +624,11 @@ class SparseVector(Vector): 11.0 >>> a.squared_distance(np.array([1., 2., 3., 4.])) 11.0 - >>> b = SparseVector(4, [2, 4], [1.0, 2.0]) + >>> b = SparseVector(4, [2], [1.0]) >>> a.squared_distance(b) - 30.0 + 26.0 >>> b.squared_distance(a) - 30.0 + 26.0 >>> b.squared_distance([1., 2.]) Traceback (most recent call last): ... -- cgit v1.2.3