Github user WeichenXu123 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19588#discussion_r152454669
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/feature/VectorIndexer.scala ---
    @@ -311,22 +342,39 @@ class VectorIndexerModel private[ml] (
       // TODO: Check more carefully about whether this whole class will be 
included in a closure.
     
       /** Per-vector transform function */
    -  private val transformFunc: Vector => Vector = {
    +  private lazy val transformFunc: Vector => Vector = {
    --- End diff --
    
    @MrBago Use `lazy val` will generate the closure only once. If use `def`, 
each time call `transformFunc` will generate the closure again.
    What you concern is when user setParams for this Model, then the param 
won't work. But, I think this is not a issue, because `Model` do not allow user 
to set params, the params are copied from estimator, isn't it ?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to