You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Seth Hendrickson (JIRA)" <ji...@apache.org> on 2017/02/27 05:20:45 UTC
[jira] [Created] (SPARK-19746) LogisticAggregator is inefficient in
indexing
Seth Hendrickson created SPARK-19746:
----------------------------------------
Summary: 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