From 200f08f947ba9369c79acf150596bbbe00e1864b Mon Sep 17 00:00:00 2001 From: MechCoder Date: Tue, 28 Jul 2015 23:04:48 +0530 Subject: [PATCH 1/3] [SPARK-9408] [PySpark] Refactor linalg.py to /linalg --- python/pyspark/mllib/linalg/__init__.py | 22 +++++++++++++++++++ .../mllib/{linalg.py => linalg/local.py} | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 python/pyspark/mllib/linalg/__init__.py rename python/pyspark/mllib/{linalg.py => linalg/local.py} (99%) diff --git a/python/pyspark/mllib/linalg/__init__.py b/python/pyspark/mllib/linalg/__init__.py new file mode 100644 index 0000000000000..bbee42623a0a2 --- /dev/null +++ b/python/pyspark/mllib/linalg/__init__.py @@ -0,0 +1,22 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +""" +Python package for local and distributed linear algebra in mllib. +""" + +from pyspark.mllib.linalg.local import * diff --git a/python/pyspark/mllib/linalg.py b/python/pyspark/mllib/linalg/local.py similarity index 99% rename from python/pyspark/mllib/linalg.py rename to python/pyspark/mllib/linalg/local.py index 334dc8e38bb8f..4552ba6f11143 100644 --- a/python/pyspark/mllib/linalg.py +++ b/python/pyspark/mllib/linalg/local.py @@ -42,7 +42,8 @@ __all__ = ['Vector', 'DenseVector', 'SparseVector', 'Vectors', - 'Matrix', 'DenseMatrix', 'SparseMatrix', 'Matrices'] + 'Matrix', 'DenseMatrix', 'SparseMatrix', 'Matrices', + '_convert_to_vector'] if sys.version_info[:2] == (2, 7): From 04c33e5ece6c5f4694a248720ea8fa9f292a6a8e Mon Sep 17 00:00:00 2001 From: MechCoder Date: Wed, 29 Jul 2015 00:18:42 +0530 Subject: [PATCH 2/3] use __all__ --- python/pyspark/mllib/linalg/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/pyspark/mllib/linalg/__init__.py b/python/pyspark/mllib/linalg/__init__.py index bbee42623a0a2..11d5bb5c6375e 100644 --- a/python/pyspark/mllib/linalg/__init__.py +++ b/python/pyspark/mllib/linalg/__init__.py @@ -20,3 +20,7 @@ """ from pyspark.mllib.linalg.local import * + +__all__ = ['Vector', 'DenseVector', 'SparseVector', 'Vectors', + 'Matrix', 'DenseMatrix', 'SparseMatrix', 'Matrices', + '_convert_to_vector'] From d870a1a3ce8e52cd4da9ee8953d803c3f0cb670a Mon Sep 17 00:00:00 2001 From: MechCoder Date: Wed, 29 Jul 2015 01:48:15 +0530 Subject: [PATCH 3/3] add vectorudt --- python/pyspark/mllib/linalg/__init__.py | 2 +- python/pyspark/mllib/linalg/local.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/pyspark/mllib/linalg/__init__.py b/python/pyspark/mllib/linalg/__init__.py index 11d5bb5c6375e..b173d61e16532 100644 --- a/python/pyspark/mllib/linalg/__init__.py +++ b/python/pyspark/mllib/linalg/__init__.py @@ -23,4 +23,4 @@ __all__ = ['Vector', 'DenseVector', 'SparseVector', 'Vectors', 'Matrix', 'DenseMatrix', 'SparseMatrix', 'Matrices', - '_convert_to_vector'] + '_convert_to_vector', 'VectorUDT', 'MatrixUDT'] diff --git a/python/pyspark/mllib/linalg/local.py b/python/pyspark/mllib/linalg/local.py index 4552ba6f11143..4cbedbd4f76e2 100644 --- a/python/pyspark/mllib/linalg/local.py +++ b/python/pyspark/mllib/linalg/local.py @@ -43,7 +43,7 @@ __all__ = ['Vector', 'DenseVector', 'SparseVector', 'Vectors', 'Matrix', 'DenseMatrix', 'SparseMatrix', 'Matrices', - '_convert_to_vector'] + '_convert_to_vector', 'VectorUDT', 'MatrixUDT'] if sys.version_info[:2] == (2, 7):