Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/6715#discussion_r32785387
--- Diff: python/pyspark/mllib/util.py ---
@@ -257,6 +257,44 @@ def load(cls, sc, path):
return cls(java_model)
+class LinearDataGenerator(object):
+ """Utils for generating linear data"""
+
+ @staticmethod
+ def generateLinearInput(intercept, weights, xMean, xVariance,
+ nPoints, seed, eps):
+ """
+ :param: intercept bias factor, the term c in X'w + c
+ :param: weights feature vector, the term w in X'w + c
+ :param: xMean Point around which the data X is centered.
+ :param: xVariance Variance of the given data
+ :param: nPoints Number of points to be generated
+ :param: seed Random Seed
+ :param: eps Used to scale the noise. If eps is set high,
+ the amount of gaussian noise added is more.
+ Returns a list of LabeledPoints of length nPoints
+ """
+ seed, nPoints = int(seed), int(nPoints)
--- End diff --
Try to avoid this style in general. `seed` and `nPoints` are separate
variables, and the right-hand side is not a list or tuple. The following would
be better:
~~~python
seed = int(seed)
nPoint = int(nPoints)
~~~
Or we can call `int(..)` inside callMLlibFunc. I'd prefer the latter.
---
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]