You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (JIRA)" <ji...@apache.org> on 2017/02/27 05:28:45 UTC
[jira] [Commented] (SPARK-19746) LogisticAggregator is inefficient
in indexing
[ https://issues.apache.org/jira/browse/SPARK-19746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15885159#comment-15885159 ]
Apache Spark commented on SPARK-19746:
--------------------------------------
User 'sethah' has created a pull request for this issue:
https://github.com/apache/spark/pull/17078
> 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
>
> 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