You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Hao Ren <in...@gmail.com> on 2014/11/19 11:39:55 UTC
Why is ALS class serializable ?
Hi,
When reading through ALS code, I find that:
class ALS private (
private var numUserBlocks: Int,
private var numProductBlocks: Int,
private var rank: Int,
private var iterations: Int,
private var lambda: Double,
private var implicitPrefs: Boolean,
private var alpha: Double,
private var seed: Long = System.nanoTime()
) extends *Serializable *with Logging
and why should ALS extend Serializable ?
if not, there will be an Exception: task is not serializable, ALS is not
serializable.
I did not find any closure functions in which ALS is referenced.
Any idea ? Thx.
Hao
--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Why-is-ALS-class-serializable-tp19262.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org
Re: Why is ALS class serializable ?
Posted by Hao Ren <in...@gmail.com>.
It makes sense.
Thx. =)
--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Why-is-ALS-class-serializable-tp19262p19472.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org
Re: Why is ALS class serializable ?
Posted by Cheng Lian <li...@gmail.com>.
When a field of an object is enclosed in a closure, the object itself is
also enclosed automatically, thus the object need to be serializable.
On 11/19/14 6:39 PM, Hao Ren wrote:
> Hi,
>
> When reading through ALS code, I find that:
>
> class ALS private (
> private var numUserBlocks: Int,
> private var numProductBlocks: Int,
> private var rank: Int,
> private var iterations: Int,
> private var lambda: Double,
> private var implicitPrefs: Boolean,
> private var alpha: Double,
> private var seed: Long = System.nanoTime()
> ) extends *Serializable *with Logging
>
> and why should ALS extend Serializable ?
>
> if not, there will be an Exception: task is not serializable, ALS is not
> serializable.
> I did not find any closure functions in which ALS is referenced.
>
> Any idea ? Thx.
>
> Hao
>
>
>
>
>
>
>
>
> --
> View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Why-is-ALS-class-serializable-tp19262.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
> For additional commands, e-mail: user-help@spark.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org