Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/3636#discussion_r26540817
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/optimization/GradientDescent.scala
---
@@ -219,4 +265,39 @@ object GradientDescent extends Logging {
(weights, stochasticLossHistory.toArray)
}
+
+ def runMiniBatchSGD(
+ data: RDD[(Double, Vector)],
+ gradient: Gradient,
+ updater: Updater,
+ stepSize: Double,
+ numIterations: Int,
+ regParam: Double,
+ miniBatchFraction: Double,
+ initialWeights: Vector): (Vector, Array[Double]) =
+ GradientDescent.runMiniBatchSGD(data, gradient, updater, stepSize,
numIterations,
+ regParam, miniBatchFraction,
initialWeights, 0.001)
+
+
+ private def isConverged(previousWeights: Vector, currentWeights: Vector,
+ initialWeights: Vector, convergenceTol: Double):
Boolean = {
+ require(previousWeights != None)
+ require(currentWeights != None)
+ // To compare with convergence tolerance
+ def solutionVecDiff(previousWeight: Vector,
--- End diff --
I would use a val instead of nested methods since solutionVecDiff is only
used once (and nested methods are more confusing to read).
---
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]