From 7388e27668800b2c958b75e13d24f0d2baebe23d Mon Sep 17 00:00:00 2001 From: Shivaram Venkataraman Date: Sat, 3 Aug 2013 18:08:43 -0700 Subject: Move implicit arg to constructor for Java access. --- .../spark/mllib/regression/GeneralizedLinearAlgorithm.scala | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'mllib/src/main/scala') diff --git a/mllib/src/main/scala/spark/mllib/regression/GeneralizedLinearAlgorithm.scala b/mllib/src/main/scala/spark/mllib/regression/GeneralizedLinearAlgorithm.scala index 0bbc9424e6..7e80737773 100644 --- a/mllib/src/main/scala/spark/mllib/regression/GeneralizedLinearAlgorithm.scala +++ b/mllib/src/main/scala/spark/mllib/regression/GeneralizedLinearAlgorithm.scala @@ -66,7 +66,10 @@ abstract class GeneralizedLinearModel[T: ClassManifest]( * NOTE(shivaram): This is an abstract class rather than a trait as we use * a view bound to convert labels to Double. */ -abstract class GeneralizedLinearAlgorithm[T <% Double, M <: GeneralizedLinearModel[T]] +abstract class GeneralizedLinearAlgorithm[T, M](implicit + t: T => Double, + tManifest: Manifest[T], + methodEv: M <:< GeneralizedLinearModel[T]) extends Logging with Serializable { // We need an optimizer mixin to solve the GLM @@ -84,15 +87,15 @@ abstract class GeneralizedLinearAlgorithm[T <% Double, M <: GeneralizedLinearMod this } - def train(input: RDD[(T, Array[Double])])(implicit mt: Manifest[T]) : M = { - val nfeatures: Int = input.take(1)(0)._2.length + def train(input: RDD[(T, Array[Double])]) : M = { + val nfeatures: Int = input.first()._2.length val initialWeights = Array.fill(nfeatures)(1.0) train(input, initialWeights) } def train( input: RDD[(T, Array[Double])], - initialWeights: Array[Double])(implicit mt: Manifest[T]) + initialWeights: Array[Double]) : M = { // Add a extra variable consisting of all 1.0's for the intercept. -- cgit v1.2.3