Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5707#discussion_r32691822
  
    --- Diff: python/pyspark/mllib/util.py ---
    @@ -169,6 +170,27 @@ def loadLabeledPoints(sc, path, minPartitions=None):
             minPartitions = minPartitions or min(sc.defaultParallelism, 2)
             return callMLlibFunc("loadLabeledPoints", sc, path, minPartitions)
     
    +    @staticmethod
    +    def appendBias(data):
    +        """
    +        Returns a new vector with `1.0` (bias) appended to
    +        the end of the input vector.
    +        """
    +        vec = _convert_to_vector(data)
    +        if isinstance(vec, SparseVector):
    +            return sp.csc_matrix(np.append(vec.toArray(), 1.0))
    --- End diff --
    
    Sorry for the slow response around the release!  If you look at other uses 
of scipy.sparse in MLlib PySpark, we always try to convert to Vector types.  
(See e.g. pyspark.mllib.feature.StandardScalerModel)
    
    It is still important to accept scipy types when given them since users 
might pass scipy types to MLlib.  But you'll need to test for whether scipy is 
available before using it.  I recommend looking for other uses of scipy in 
MLlib PySpark for examples.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to