spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject [13/28] git commit: Change some docstrings and add some others.
Date Thu, 26 Dec 2013 06:31:30 GMT
Change some docstrings and add some others.


Project: http://git-wip-us.apache.org/repos/asf/incubator-spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spark/commit/0a5cacb9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spark/tree/0a5cacb9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spark/diff/0a5cacb9

Branch: refs/heads/master
Commit: 0a5cacb9615d960c93bca8cc3f4ad2a599f94ec0
Parents: b835ddf
Author: Tor Myklebust <tmyklebu@gmail.com>
Authored: Fri Dec 20 02:05:15 2013 -0500
Committer: Tor Myklebust <tmyklebu@gmail.com>
Committed: Fri Dec 20 02:05:15 2013 -0500

----------------------------------------------------------------------
 python/pyspark/mllib.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/0a5cacb9/python/pyspark/mllib.py
----------------------------------------------------------------------
diff --git a/python/pyspark/mllib.py b/python/pyspark/mllib.py
index ce1363f..928caa9 100644
--- a/python/pyspark/mllib.py
+++ b/python/pyspark/mllib.py
@@ -146,7 +146,7 @@ def _linear_predictor_typecheck(x, coeffs):
         raise TypeError("Argument of type " + type(x) + " unsupported");
 
 class LinearModel(object):
-    """Something containing a vector of coefficients and an intercept."""
+    """Something that has a vector of coefficients and an intercept."""
     def __init__(self, coeff, intercept):
         self._coeff = coeff
         self._intercept = intercept
@@ -305,6 +305,7 @@ class KMeansModel(object):
         self.centers = centers_
 
     def predict(self, x):
+        """Find the cluster to which x belongs in this model."""
         best = 0
         best_distance = 1e75
         for i in range(0, self.centers.shape[0]):
@@ -318,6 +319,7 @@ class KMeansModel(object):
     @classmethod
     def train(cls, sc, data, k, maxIterations = 100, runs = 1,
             initialization_mode="k-means||"):
+        """Train a k-means clustering model."""
         dataBytes = _get_unmangled_double_vector_rdd(data)
         ans = sc._jvm.PythonMLLibAPI().trainKMeansModel(dataBytes._jrdd,
                 k, maxIterations, runs, initialization_mode)


Mime
View raw message