spark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dataginjaninja <rickett.stepha...@gmail.com>
Subject implementing the VectorAccumulatorParam
Date Mon, 09 Jun 2014 15:57:48 GMT
The  programming-guide
<http://spark.apache.org/docs/latest/programming-guide.html>   has the
following:
    
    object VectorAccumulatorParam extends AccumulatorParam[Vector] {
      def zero(initialValue: Vector): Vector = {
        Vector.zeros(initialValue.size)
      }
      def addInPlace(v1: Vector, v2: Vector): Vector = {
        v1 += v2
      }
    }


// Then, create an Accumulator of this type:
val vecAccum = sc.accumulator(new Vector(...))(VectorAccumulatorParam)

However, when I try to use this I get an error:

scala> import org.apache.spark.AccumulatorParam
import org.apache.spark.AccumulatorParam

scala> object VectorAccumulatorParam extends AccumulatorParam[Vector] {
     |   def zero(initialValue: Vector): Vector = {
     |     Vector.zeros(initialValue.size)
     |   }
     |   def addInPlace(v1: Vector, v2: Vector): Vector = {
     |     v1 += v2
     |   }
     | }
<console>:12: error: type Vector takes type parameters
       object VectorAccumulatorParam extends AccumulatorParam[Vector] {
                                                              ^


Last thing, am I posting on the wrong list?



-----
Cheers,

Stephanie
--
View this message in context: http://apache-spark-developers-list.1001551.n3.nabble.com/implementing-the-VectorAccumulatorParam-tp6973.html
Sent from the Apache Spark Developers List mailing list archive at Nabble.com.

Mime
View raw message