Github user dbtsai commented on a diff in the pull request:
https://github.com/apache/spark/pull/9843#discussion_r46017051
--- 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 --
`idf(indices(k))` will do binary search when `idf` is `sparse`, and this
will be too expensive. Have them handled using specialized method.
---
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]