Github user dbtsai commented on a diff in the pull request:
https://github.com/apache/spark/pull/9843#discussion_r46022674
--- Diff: mllib/src/main/scala/org/apache/spark/mllib/feature/IDF.scala ---
@@ -211,14 +213,17 @@ private object IDFModel {
val n = v.size
v match {
case SparseVector(size, indices, values) =>
+ val newElements = new ArrayBuffer[(Int, Double)]
val nnz = indices.size
- val newValues = new Array[Double](nnz)
var k = 0
while (k < nnz) {
- newValues(k) = values(k) * idf(indices(k))
+ val newValue = values(k) * idf(indices(k))
--- End diff --
The existing code is fine since the idf vector is always dense which has
constant time lookup. In your change, that will strongly impact the
performance, so I don't think it should belong to a separate PR.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]