Github user yinxusen commented on a diff in the pull request: https://github.com/apache/spark/pull/458#discussion_r11833279 --- Diff: mllib/src/main/scala/org/apache/spark/mllib/regression/Lasso.scala --- @@ -189,3 +230,70 @@ object LassoWithSGD { sc.stop() } } + +object LassoWithADMM { + /** + * Train a Lasso model given an RDD of (label, features) pairs using ADMM. We run a fixed number + * of outer ADMM iterations. The weights are initialized using the initial weights provided. + * + * @param input RDD of (label, array of features) pairs. Each pair describes a row of the data + * matrix A as well as the corresponding right hand side label y + * @param numPartitions Number of data blocks to partition the data into + * @param numIterations Number of iterations of gradient descent to run. + * @param l1RegParam l1-regularization parameter + * @param l2RegParam l2-regularization parameter + * @param penalty ADMM penalty of the constraint + * @param initialWeights set of weights to be used. Array should be equal in size to + * the number of features in the data. + */ + def train( + input: RDD[LabeledPoint], + numPartitions: Int, + numIterations: Int, + l1RegParam: Double, + l2RegParam: Double, + penalty: Double, + initialWeights: Vector): LassoModel = { + new LassoWithADMM(numPartitions, numIterations, l1RegParam, l2RegParam, penalty) + .run(input, initialWeights) + } + + /** + * Train a Lasso model given an RDD of (label, features) pairs using ADMM. We run a fixed number + * of outer ADMM iterations. The weights are initialized using default value. + * + * @param input RDD of (label, array of features) pairs. Each pair describes a row of the data + * matrix A as well as the corresponding right hand side label y + * @param numPartitions Number of data blocks to partition the data into + * @param numIterations Number of iterations of gradient descent to run. + * @param l1RegParam l1-regularization parameter + * @param l2RegParam l2-regularization parameter + * @param penalty ADMM penalty of the constraint + */ + def train( + input: RDD[LabeledPoint], + numPartitions: Int, + numIterations: Int, + l1RegParam: Double, + l2RegParam: Double, + penalty: Double): LassoModel = { + new LassoWithADMM(numPartitions, numIterations, l1RegParam, l2RegParam, penalty).run(input) + } + + def main(args: Array[String]) { + if (args.length != 5) { --- End diff -- length of `args` is 7.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---