diff options
author | Joseph K. Bradley <joseph@databricks.com> | 2015-07-20 16:49:55 -0700 |
---|---|---|
committer | Xiangrui Meng <meng@databricks.com> | 2015-07-20 16:49:55 -0700 |
commit | a5d05819afcc9b19aeae4817d842205f32b34335 (patch) | |
tree | 211255b9c70ba59138a342d076b823067bf697d2 /python/pyspark/mllib | |
parent | a1064df0ee3daf496800be84293345a10e1497d9 (diff) | |
download | spark-a5d05819afcc9b19aeae4817d842205f32b34335.tar.gz spark-a5d05819afcc9b19aeae4817d842205f32b34335.tar.bz2 spark-a5d05819afcc9b19aeae4817d842205f32b34335.zip |
[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 <joseph@databricks.com>
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
Diffstat (limited to 'python/pyspark/mllib')
-rw-r--r-- | python/pyspark/mllib/linalg.py | 8 |
1 files 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): ... |