Skip to content
Snippets Groups Projects
  1. Dec 14, 2015
  2. Nov 23, 2015
    • Bryan Cutler's avatar
      [SPARK-10560][PYSPARK][MLLIB][DOCS] Make StreamingLogisticRegressionWithSGD... · 10574564
      Bryan Cutler authored
      [SPARK-10560][PYSPARK][MLLIB][DOCS] Make StreamingLogisticRegressionWithSGD Python API equal to Scala one
      
      This is to bring the API documentation of StreamingLogisticReressionWithSGD and StreamingLinearRegressionWithSGC in line with the Scala versions.
      
      -Fixed the algorithm descriptions
      -Added default values to parameter descriptions
      -Changed StreamingLogisticRegressionWithSGD regParam to default to 0, as in the Scala version
      
      Author: Bryan Cutler <bjcutler@us.ibm.com>
      
      Closes #9141 from BryanCutler/StreamingLogisticRegressionWithSGD-python-api-sync.
      10574564
  3. Nov 10, 2015
  4. Nov 09, 2015
  5. Nov 07, 2015
    • Yu ISHIKAWA's avatar
      [SPARK-8467] [MLLIB] [PYSPARK] Add LDAModel.describeTopics() in Python · 2ff0e79a
      Yu ISHIKAWA authored
      Could jkbradley and davies review it?
      
      - Create a wrapper class: `LDAModelWrapper` for `LDAModel`. Because we can't deal with the return value of`describeTopics` in Scala from pyspark directly. `Array[(Array[Int], Array[Double])]` is too complicated to convert it.
      - Add `loadLDAModel` in `PythonMLlibAPI`. Since `LDAModel` in Scala is an abstract class and we need to call `load` of `DistributedLDAModel`.
      
      [[SPARK-8467] Add LDAModel.describeTopics() in Python - ASF JIRA](https://issues.apache.org/jira/browse/SPARK-8467)
      
      Author: Yu ISHIKAWA <yuu.ishikawa@gmail.com>
      
      Closes #8643 from yu-iskw/SPARK-8467-2.
      2ff0e79a
  6. Nov 06, 2015
  7. Nov 04, 2015
  8. Nov 02, 2015
    • Xiangrui Meng's avatar
      [SPARK-11358][MLLIB] deprecate runs in k-means · 33ae7a35
      Xiangrui Meng authored
      This PR deprecates `runs` in k-means. `runs` introduces extra complexity and overhead in MLlib's k-means implementation. I haven't seen much usage with `runs` not equal to `1`. We don't have a unit test for it either. We can deprecate this method in 1.6, and void it in 1.7. It helps us simplify the implementation.
      
      cc: srowen
      
      Author: Xiangrui Meng <meng@databricks.com>
      
      Closes #9322 from mengxr/SPARK-11358.
      33ae7a35
  9. Oct 28, 2015
  10. Oct 27, 2015
  11. Oct 26, 2015
    • noelsmith's avatar
      [SPARK-10271][PYSPARK][MLLIB] Added @since tags to pyspark.mllib.clustering · 5d4f6abe
      noelsmith authored
      Duplicated the since decorator from pyspark.sql into pyspark (also tweaked to handle functions without docstrings).
      
      Added since to methods + "versionadded::" to classes (derived from the git file history in pyspark).
      
      Author: noelsmith <mail@noelsmith.com>
      
      Closes #8627 from noel-smith/SPARK-10271-since-mllib-clustering.
      5d4f6abe
  12. Oct 23, 2015
  13. Oct 22, 2015
  14. Oct 20, 2015
    • noelsmith's avatar
      [SPARK-10269][PYSPARK][MLLIB] Add @since annotation to pyspark.mllib.classification · 04521ea0
      noelsmith authored
      Duplicated the since decorator from pyspark.sql into pyspark (also tweaked to handle functions without docstrings).
      
      Added since to methods + "versionadded::" to classes derived from the file history.
      
      Note - some methods are inherited from the regression module (i.e. LinearModel.intercept) so these won't have version numbers in the API docs until that model is updated.
      
      Author: noelsmith <mail@noelsmith.com>
      
      Closes #8626 from noel-smith/SPARK-10269-since-mlib-classification.
      04521ea0
    • noelsmith's avatar
      [SPARK-10272][PYSPARK][MLLIB] Added @since tags to pyspark.mllib.evaluation · 82e9d9c8
      noelsmith authored
      Duplicated the since decorator from pyspark.sql into pyspark (also tweaked to handle functions without docstrings).
      
      Added since to public methods + "versionadded::" to classes (derived from the git file history in pyspark).
      
      Note - I added also the tags to MultilabelMetrics even though it isn't declared as public in the __all__ statement... if that's incorrect - I'll remove.
      
      Author: noelsmith <mail@noelsmith.com>
      
      Closes #8628 from noel-smith/SPARK-10272-since-mllib-evalutation.
      82e9d9c8
  15. Oct 16, 2015
    • zero323's avatar
      [SPARK-11084] [ML] [PYTHON] Check if index can contain non-zero value before binary search · 8ac71d62
      zero323 authored
      At this moment `SparseVector.__getitem__` executes `np.searchsorted` first and checks if result is in an expected range after that. It is possible to check if index can contain non-zero value before executing `np.searchsorted`.
      
      Author: zero323 <matthew.szymkiewicz@gmail.com>
      
      Closes #9098 from zero323/sparse_vector_getitem_improved.
      8ac71d62
    • Bhargav Mangipudi's avatar
      [SPARK-11050] [MLLIB] PySpark SparseVector can return wrong index in e… · 1ec0a0dc
      Bhargav Mangipudi authored
      …rror message
      
      For negative indices in the SparseVector, we update the index value. If we have an incorrect index
      at this point, the error message has the incorrect *updated* index instead of the original one. This
      change contains the fix for the same.
      
      Author: Bhargav Mangipudi <bhargav.mangipudi@gmail.com>
      
      Closes #9069 from bhargav/spark-10759.
      1ec0a0dc
  16. Oct 09, 2015
    • Vladimir Vladimirov's avatar
      [SPARK-10535] Sync up API for matrix factorization model between Scala and PySpark · c1b4ce43
      Vladimir Vladimirov authored
      Support for recommendUsersForProducts and recommendProductsForUsers in matrix factorization model for PySpark
      
      Author: Vladimir Vladimirov <vladimir.vladimirov@magnetic.com>
      
      Closes #8700 from smartkiwi/SPARK-10535_.
      c1b4ce43
    • Bryan Cutler's avatar
      [SPARK-10959] [PYSPARK] StreamingLogisticRegressionWithSGD does not train with... · 5410747a
      Bryan Cutler authored
      [SPARK-10959] [PYSPARK] StreamingLogisticRegressionWithSGD does not train with given regParam and convergenceTol parameters
      
      These params were being passed into the StreamingLogisticRegressionWithSGD constructor, but not transferred to the call for model training.  Same with StreamingLinearRegressionWithSGD.  I added the params as named arguments to the call and also fixed the intercept parameter, which was being passed as regularization value.
      
      Author: Bryan Cutler <bjcutler@us.ibm.com>
      
      Closes #9002 from BryanCutler/StreamingSGD-convergenceTol-bug-10959.
      5410747a
  17. Oct 08, 2015
    • zero323's avatar
      [SPARK-10973] [ML] [PYTHON] __gettitem__ method throws IndexError exception when we… · 8e67882b
      zero323 authored
      __gettitem__ method throws IndexError exception when we try to access index after the last non-zero entry
      
          from pyspark.mllib.linalg import Vectors
          sv = Vectors.sparse(5, {1: 3})
          sv[0]
          ## 0.0
          sv[1]
          ## 3.0
          sv[2]
          ## Traceback (most recent call last):
          ##   File "<stdin>", line 1, in <module>
          ##   File "/python/pyspark/mllib/linalg/__init__.py", line 734, in __getitem__
          ##     row_ind = inds[insert_index]
          ## IndexError: index out of bounds
      
      Author: zero323 <matthew.szymkiewicz@gmail.com>
      
      Closes #9009 from zero323/sparse_vector_index_error.
      8e67882b
  18. Oct 07, 2015
  19. Sep 21, 2015
  20. Sep 18, 2015
  21. Sep 17, 2015
  22. Sep 16, 2015
  23. Sep 15, 2015
  24. Sep 14, 2015
  25. Aug 15, 2015
    • Joseph K. Bradley's avatar
      [SPARK-9805] [MLLIB] [PYTHON] [STREAMING] Added _eventually for ml streaming pyspark tests · 1db7179f
      Joseph K. Bradley authored
      Recently, PySpark ML streaming tests have been flaky, most likely because of the batches not being processed in time.  Proposal: Replace the use of _ssc_wait (which waits for a fixed amount of time) with a method which waits for a fixed amount of time but can terminate early based on a termination condition method.  With this, we can extend the waiting period (to make tests less flaky) but also stop early when possible (making tests faster on average, which I verified locally).
      
      CC: mengxr tdas freeman-lab
      
      Author: Joseph K. Bradley <joseph@databricks.com>
      
      Closes #8087 from jkbradley/streaming-ml-tests.
      1db7179f
  26. Aug 13, 2015
  27. Aug 05, 2015
    • Mike Dusenberry's avatar
      [SPARK-6486] [MLLIB] [PYTHON] Add BlockMatrix to PySpark. · 34dcf101
      Mike Dusenberry authored
      mengxr This adds the `BlockMatrix` to PySpark.  I have the conversions to `IndexedRowMatrix` and `CoordinateMatrix` ready as well, so once PR #7554 is completed (which relies on PR #7746), this PR can be finished.
      
      Author: Mike Dusenberry <mwdusenb@us.ibm.com>
      
      Closes #7761 from dusenberrymw/SPARK-6486_Add_BlockMatrix_to_PySpark and squashes the following commits:
      
      27195c2 [Mike Dusenberry] Adding one more check to _convert_to_matrix_block_tuple, and a few minor documentation changes.
      ae50883 [Mike Dusenberry] Minor update: BlockMatrix should inherit from DistributedMatrix.
      b8acc1c [Mike Dusenberry] Moving BlockMatrix to pyspark.mllib.linalg.distributed, updating the logic to match that of the other distributed matrices, adding conversions, and adding documentation.
      c014002 [Mike Dusenberry] Using properties for better documentation.
      3bda6ab [Mike Dusenberry] Adding documentation.
      8fb3095 [Mike Dusenberry] Small cleanup.
      e17af2e [Mike Dusenberry] Adding BlockMatrix to PySpark.
      34dcf101
  28. Aug 04, 2015
    • Mike Dusenberry's avatar
      [SPARK-6485] [MLLIB] [PYTHON] Add CoordinateMatrix/RowMatrix/IndexedRowMatrix to PySpark. · 571d5b53
      Mike Dusenberry authored
      This PR adds the RowMatrix, IndexedRowMatrix, and CoordinateMatrix distributed matrices to PySpark.  Each distributed matrix class acts as a wrapper around the Scala/Java counterpart by maintaining a reference to the Java object.  New distributed matrices can be created using factory methods added to DistributedMatrices, which creates the Java distributed matrix and then wraps it with the corresponding PySpark class.  This design allows for simple conversion between the various distributed matrices, and lets us re-use the Scala code.  Serialization between Python and Java is implemented using DataFrames as needed for IndexedRowMatrix and CoordinateMatrix for simplicity.  Associated documentation and unit-tests have also been added.  To facilitate code review, this PR implements access to the rows/entries as RDDs, the number of rows & columns, and conversions between the various distributed matrices (not including BlockMatrix), and does not implement the other linear algebra functions of the matrices, although this will be very simple to add now.
      
      Author: Mike Dusenberry <mwdusenb@us.ibm.com>
      
      Closes #7554 from dusenberrymw/SPARK-6485_Add_CoordinateMatrix_RowMatrix_IndexedMatrix_to_PySpark and squashes the following commits:
      
      bb039cb [Mike Dusenberry] Minor documentation update.
      b887c18 [Mike Dusenberry] Updating the matrix conversion logic again to make it even cleaner.  Now, we allow the 'rows' parameter in the constructors to be either an RDD or the Java matrix object. If 'rows' is an RDD, we create a Java matrix object, wrap it, and then store that.  If 'rows' is a Java matrix object of the correct type, we just wrap and store that directly.  This is only for internal usage, and publicly, we still require 'rows' to be an RDD.  We no longer store the 'rows' RDD, and instead just compute it from the Java object when needed.  The point of this is that when we do matrix conversions, we do the conversion on the Scala/Java side, which returns a Java object, so we should use that directly, but exposing 'java_matrix' parameter in the public API is not ideal. This non-public feature of allowing 'rows' to be a Java matrix object is documented in the '__init__' constructor docstrings, which are not part of the generated public API, and doctests are also included.
      7f0dcb6 [Mike Dusenberry] Updating module docstring.
      cfc1be5 [Mike Dusenberry] Use 'new SQLContext(matrix.rows.sparkContext)' rather than 'SQLContext.getOrCreate', as the later doesn't guarantee that the SparkContext will be the same as for the matrix.rows data.
      687e345 [Mike Dusenberry] Improving conversion performance.  This adds an optional 'java_matrix' parameter to the constructors, and pulls the conversion logic out into a '_create_from_java' function. Now, if the constructors are given a valid Java distributed matrix object as 'java_matrix', they will store those internally, rather than create a new one on the Scala/Java side.
      3e50b6e [Mike Dusenberry] Moving the distributed matrices to pyspark.mllib.linalg.distributed.
      308f197 [Mike Dusenberry] Using properties for better documentation.
      1633f86 [Mike Dusenberry] Minor documentation cleanup.
      f0c13a7 [Mike Dusenberry] CoordinateMatrix should inherit from DistributedMatrix.
      ffdd724 [Mike Dusenberry] Updating doctests to make documentation cleaner.
      3fd4016 [Mike Dusenberry] Updating docstrings.
      27cd5f6 [Mike Dusenberry] Simplifying input conversions in the constructors for each distributed matrix.
      a409cf5 [Mike Dusenberry] Updating doctests to be less verbose by using lists instead of DenseVectors explicitly.
      d19b0ba [Mike Dusenberry] Updating code and documentation to note that a vector-like object (numpy array, list, etc.) can be used in place of explicit Vector object, and adding conversions when necessary to RowMatrix construction.
      4bd756d [Mike Dusenberry] Adding param documentation to IndexedRow and MatrixEntry.
      c6bded5 [Mike Dusenberry] Move conversion logic from tuples to IndexedRow or MatrixEntry types from within the IndexedRowMatrix and CoordinateMatrix constructors to separate _convert_to_indexed_row and _convert_to_matrix_entry functions.
      329638b [Mike Dusenberry] Moving the Experimental tag to the top of each docstring.
      0be6826 [Mike Dusenberry] Simplifying doctests by removing duplicated rows/entries RDDs within the various tests.
      c0900df [Mike Dusenberry] Adding the colons that were accidentally not inserted.
      4ad6819 [Mike Dusenberry] Documenting the  and  parameters.
      3b854b9 [Mike Dusenberry] Minor updates to documentation.
      10046e8 [Mike Dusenberry] Updating documentation to use class constructors instead of the removed DistributedMatrices factory methods.
      119018d [Mike Dusenberry] Adding static  methods to each of the distributed matrix classes to consolidate conversion logic.
      4d7af86 [Mike Dusenberry] Adding type checks to the constructors.  Although it is slightly verbose, it is better for the user to have a good error message than a cryptic stacktrace.
      93b6a3d [Mike Dusenberry] Pulling the DistributedMatrices Python class out of this pull request.
      f6f3c68 [Mike Dusenberry] Pulling the DistributedMatrices Scala class out of this pull request.
      6a3ecb7 [Mike Dusenberry] Updating pattern matching.
      08f287b [Mike Dusenberry] Slight reformatting of the documentation.
      a245dc0 [Mike Dusenberry] Updating Python doctests for compatability between Python 2 & 3. Since Python 3 removed the idea of a separate 'long' type, all values that would have been outputted as a 'long' (ex: '4L') will now be treated as an 'int' and outputed as one (ex: '4').  The doctests now explicitly convert to ints so that both Python 2 and 3 will have the same output.  This is fine since the values are all small, and thus can be easily represented as ints.
      4d3a37e [Mike Dusenberry] Reformatting a few long Python doctest lines.
      7e3ca16 [Mike Dusenberry] Fixing long lines.
      f721ead [Mike Dusenberry] Updating documentation for each of the distributed matrices.
      ab0e8b6 [Mike Dusenberry] Updating unit test to be more useful.
      dda2f89 [Mike Dusenberry] Added wrappers for the conversions between the various distributed matrices.  Added logic to be able to access the rows/entries of the distributed matrices, which requires serialization through DataFrames for IndexedRowMatrix and CoordinateMatrix types. Added unit tests.
      0cd7166 [Mike Dusenberry] Implemented the CoordinateMatrix API in PySpark, following the idea of the IndexedRowMatrix API, including using DataFrames for serialization.
      3c369cb [Mike Dusenberry] Updating the architecture a bit to make conversions between the various distributed matrix types easier.  The different distributed matrix classes are now only wrappers around the Java objects, and take the Java object as an argument during construction.  This way, we can call  for example on an , which returns a reference to a Java RowMatrix object, and then construct a PySpark RowMatrix object wrapped around the Java object.  This is analogous to the behavior of PySpark RDDs and DataFrames.  We now delegate creation of the various distributed matrices from scratch in PySpark to the factory methods on .
      4bdd09b [Mike Dusenberry] Implemented the IndexedRowMatrix API in PySpark, following the idea of the RowMatrix API.  Note that for the IndexedRowMatrix, we use DataFrames to serialize the data between Python and Scala/Java, so we accept PySpark RDDs, then convert to a DataFrame, then convert back to RDDs on the Scala/Java side before constructing the IndexedRowMatrix.
      23bf1ec [Mike Dusenberry] Updating documentation to add PySpark RowMatrix. Inserting newline above doctest so that it renders properly in API docs.
      b194623 [Mike Dusenberry] Updating design to have a PySpark RowMatrix simply create and keep a reference to a wrapper over a Java RowMatrix.  Updating DistributedMatrices factory methods to accept numRows and numCols with default values.  Updating PySpark DistributedMatrices factory method to simply create a PySpark RowMatrix. Adding additional doctests for numRows and numCols parameters.
      bc2d220 [Mike Dusenberry] Adding unit tests for RowMatrix methods.
      d7e316f [Mike Dusenberry] Implemented the RowMatrix API in PySpark by doing the following: Added a DistributedMatrices class to contain factory methods for creating the various distributed matrices.  Added a factory method for creating a RowMatrix from an RDD of Vectors.  Added a createRowMatrix function to the PythonMLlibAPI to interface with the factory method.  Added DistributedMatrix, DistributedMatrices, and RowMatrix classes to the pyspark.mllib.linalg api.
      571d5b53
  29. Jul 30, 2015
    • Xiangrui Meng's avatar
      [SPARK-9408] [PYSPARK] [MLLIB] Refactor linalg.py to /linalg · ca71cc8c
      Xiangrui Meng authored
      This is based on MechCoder 's PR https://github.com/apache/spark/pull/7731. Hopefully it could pass tests. MechCoder I tried to make minimal changes. If this passes Jenkins, we can merge this one first and then try to move `__init__.py` to `local.py` in a separate PR.
      
      Closes #7731
      
      Author: Xiangrui Meng <meng@databricks.com>
      
      Closes #7746 from mengxr/SPARK-9408 and squashes the following commits:
      
      0e05a3b [Xiangrui Meng] merge master
      1135551 [Xiangrui Meng] add a comment for str(...)
      c48cae0 [Xiangrui Meng] update tests
      173a805 [Xiangrui Meng] move linalg.py to linalg/__init__.py
      ca71cc8c
  30. Jul 28, 2015
    • MechCoder's avatar
      [SPARK-7105] [PYSPARK] [MLLIB] Support model save/load in GMM · 198d181d
      MechCoder authored
      This PR introduces save / load for GMM's in python API.
      
      Also I refactored `GaussianMixtureModel` and inherited it from `JavaModelWrapper` with model being `GaussianMixtureModelWrapper`, a wrapper which provides convenience methods to `GaussianMixtureModel` (due to serialization and deserialization issues) and I moved the creation of gaussians to the scala backend.
      
      Author: MechCoder <manojkumarsivaraj334@gmail.com>
      
      Closes #7617 from MechCoder/python_gmm_save_load and squashes the following commits:
      
      9c305aa [MechCoder] [SPARK-7105] [PySpark] [MLlib] Support model save/load in GMM
      198d181d
Loading