Github user AnthonyTruchet commented on a diff in the pull request:
https://github.com/apache/spark/pull/17076#discussion_r103249915
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/classification/LinearSVC.scala ---
@@ -440,19 +440,9 @@ private class LinearSVCAggregator(
private val numFeatures: Int = bcFeaturesStd.value.length
private val numFeaturesPlusIntercept: Int = if (fitIntercept)
numFeatures + 1 else numFeatures
- private val coefficients: Vector = bcCoefficients.value
private var weightSum: Double = 0.0
private var lossSum: Double = 0.0
- require(numFeaturesPlusIntercept == coefficients.size, s"Dimension
mismatch. Coefficients " +
- s"length ${coefficients.size}, FeaturesStd length ${numFeatures},
fitIntercept: $fitIntercept")
-
- private val coefficientsArray = coefficients match {
- case dv: DenseVector => dv.values
- case _ =>
- throw new IllegalArgumentException(
- s"coefficients only supports dense vector but got type
${coefficients.getClass}.")
- }
- private val gradientSumArray =
Array.fill[Double](coefficientsArray.length)(0)
+ private lazy val gradientSumArray = new
Array[Double](numFeaturesPlusIntercept)
--- End diff --
I'm not very confident in my understanding of @transcient annotation when
comined with lazy but I would expect it here. Can s.o. more versed confirm or
infirm ?
http://fdahms.com/2015/10/14/scala-and-the-transient-lazy-val-pattern/
http://stackoverflow.com/questions/34769220/difference-when-serializing-a-lazy-val-with-or-without-transient
(unanswered)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]