[ 
https://issues.apache.org/jira/browse/SPARK-19746?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Apache Spark reassigned SPARK-19746:
------------------------------------

    Assignee: Apache Spark

> LogisticAggregator is inefficient in indexing
> ---------------------------------------------
>
>                 Key: SPARK-19746
>                 URL: https://issues.apache.org/jira/browse/SPARK-19746
>             Project: Spark
>          Issue Type: Improvement
>          Components: ML
>    Affects Versions: 2.1.0
>            Reporter: Seth Hendrickson
>            Assignee: Apache Spark
>
> The following code occurs in the `LogisticAggregator.add` method, which is a 
> performance critical path.
> {code}
> val localCoefficients = bcCoefficients.value
> features.foreachActive { (index, value) =>
>       val stdValue = value / localFeaturesStd(index)
>       var j = 0
>       while (j < numClasses) {
>         margins(j) += localCoefficients(index * numClasses + j) * stdValue
>         j += 1
>       }
>     }
> {code}
> `llocalCoefficients(index * numClasses + j)` calls the `apply` method on 
> `Vector`, which dispatches to `asBreeze(index * numClasses + j)` which 
> creates a new Breeze vector, and then indexes it. This is very inefficient, 
> creates a lot of unnecessary garbage, and we can avoid it by indexing the 
> underlying array.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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

Reply via email to