aboutsummaryrefslogtreecommitdiff
path: root/mllib
diff options
context:
space:
mode:
authorShivaram Venkataraman <shivaram@eecs.berkeley.edu>2013-08-03 18:08:43 -0700
committerShivaram Venkataraman <shivaram@eecs.berkeley.edu>2013-08-03 18:08:43 -0700
commit7388e27668800b2c958b75e13d24f0d2baebe23d (patch)
treefb6f482d7bd28150dcbbe7be9a49884614d0df90 /mllib
parent00339cc0328b692417ad0b9aeb23d522edbb93e5 (diff)
downloadspark-7388e27668800b2c958b75e13d24f0d2baebe23d.tar.gz
spark-7388e27668800b2c958b75e13d24f0d2baebe23d.tar.bz2
spark-7388e27668800b2c958b75e13d24f0d2baebe23d.zip
Move implicit arg to constructor for Java access.
Diffstat (limited to 'mllib')
-rw-r--r--mllib/src/main/scala/spark/mllib/regression/GeneralizedLinearAlgorithm.scala11
1 files changed, 7 insertions, 4 deletions
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.