diff options
author | Xiangrui Meng <meng@databricks.com> | 2014-05-07 16:01:11 -0700 |
---|---|---|
committer | Patrick Wendell <pwendell@gmail.com> | 2014-05-07 16:01:11 -0700 |
commit | 3188553f73970270717a7fee4a116e29ad4becc9 (patch) | |
tree | 6182dd70e119ea8fc7758f667ddf8564211b3f75 /python/pyspark/mllib/linalg.py | |
parent | 4bec84b6a23e1e642708a70a6c7ef7b3d1df9b3e (diff) | |
download | spark-3188553f73970270717a7fee4a116e29ad4becc9.tar.gz spark-3188553f73970270717a7fee4a116e29ad4becc9.tar.bz2 spark-3188553f73970270717a7fee4a116e29ad4becc9.zip |
[SPARK-1743][MLLIB] add loadLibSVMFile and saveAsLibSVMFile to pyspark
Make loading/saving labeled data easier for pyspark users.
Also changed type check in `SparseVector` to allow numpy integers.
Author: Xiangrui Meng <meng@databricks.com>
Closes #672 from mengxr/pyspark-mllib-util and squashes the following commits:
2943fa7 [Xiangrui Meng] format docs
d61668d [Xiangrui Meng] add loadLibSVMFile and saveAsLibSVMFile to pyspark
Diffstat (limited to 'python/pyspark/mllib/linalg.py')
-rw-r--r-- | python/pyspark/mllib/linalg.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/python/pyspark/mllib/linalg.py b/python/pyspark/mllib/linalg.py index 0aa3a51de7..7511ca7573 100644 --- a/python/pyspark/mllib/linalg.py +++ b/python/pyspark/mllib/linalg.py @@ -49,8 +49,7 @@ class SparseVector(object): >>> print SparseVector(4, [1, 3], [1.0, 5.5]) [1: 1.0, 3: 5.5] """ - assert type(size) == int, "first argument must be an int" - self.size = size + self.size = int(size) assert 1 <= len(args) <= 2, "must pass either 2 or 3 arguments" if len(args) == 1: pairs = args[0] |