Skip to content
Snippets Groups Projects
Commit 7388e276 authored by Shivaram Venkataraman's avatar Shivaram Venkataraman
Browse files

Move implicit arg to constructor for Java access.

parent 00339cc0
No related branches found
No related tags found
No related merge requests found
...@@ -66,7 +66,10 @@ abstract class GeneralizedLinearModel[T: ClassManifest]( ...@@ -66,7 +66,10 @@ abstract class GeneralizedLinearModel[T: ClassManifest](
* NOTE(shivaram): This is an abstract class rather than a trait as we use * NOTE(shivaram): This is an abstract class rather than a trait as we use
* a view bound to convert labels to Double. * 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 { extends Logging with Serializable {
// We need an optimizer mixin to solve the GLM // We need an optimizer mixin to solve the GLM
...@@ -84,15 +87,15 @@ abstract class GeneralizedLinearAlgorithm[T <% Double, M <: GeneralizedLinearMod ...@@ -84,15 +87,15 @@ abstract class GeneralizedLinearAlgorithm[T <% Double, M <: GeneralizedLinearMod
this this
} }
def train(input: RDD[(T, Array[Double])])(implicit mt: Manifest[T]) : M = { def train(input: RDD[(T, Array[Double])]) : M = {
val nfeatures: Int = input.take(1)(0)._2.length val nfeatures: Int = input.first()._2.length
val initialWeights = Array.fill(nfeatures)(1.0) val initialWeights = Array.fill(nfeatures)(1.0)
train(input, initialWeights) train(input, initialWeights)
} }
def train( def train(
input: RDD[(T, Array[Double])], input: RDD[(T, Array[Double])],
initialWeights: Array[Double])(implicit mt: Manifest[T]) initialWeights: Array[Double])
: M = { : M = {
// Add a extra variable consisting of all 1.0's for the intercept. // Add a extra variable consisting of all 1.0's for the intercept.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment