spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Apache Spark (JIRA)" <j...@apache.org>
Subject [jira] [Assigned] (SPARK-19746) LogisticAggregator is inefficient in indexing
Date Mon, 27 Feb 2017 05:28:45 GMT

     [ 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: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org


Mime
View raw message