aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorTor Myklebust <tmyklebu@gmail.com>2013-12-20 02:05:15 -0500
committerTor Myklebust <tmyklebu@gmail.com>2013-12-20 02:05:15 -0500
commit0a5cacb9615d960c93bca8cc3f4ad2a599f94ec0 (patch)
treea9097e1d799b81a66cdc67a84322da5e0ba2fb9d /python
parentb835ddf3dffe8698dab3b42c14a9da472868b13c (diff)
downloadspark-0a5cacb9615d960c93bca8cc3f4ad2a599f94ec0.tar.gz
spark-0a5cacb9615d960c93bca8cc3f4ad2a599f94ec0.tar.bz2
spark-0a5cacb9615d960c93bca8cc3f4ad2a599f94ec0.zip
Change some docstrings and add some others.
Diffstat (limited to 'python')
-rw-r--r--python/pyspark/mllib.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/python/pyspark/mllib.py b/python/pyspark/mllib.py
index ce1363fd17..928caa9e80 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)