Github user Ishiihara commented on a diff in the pull request:
https://github.com/apache/spark/pull/2494#discussion_r17878647
--- Diff: mllib/src/main/scala/org/apache/spark/mllib/feature/IDF.scala ---
@@ -123,7 +134,17 @@ private object IDF {
val inv = new Array[Double](n)
var j = 0
while (j < n) {
- inv(j) = math.log((m + 1.0)/ (df(j) + 1.0))
+ /*
+ * If the term is not present in the minimum
+ * number of documents, set IDF to 0. This
+ * will cause multiplication in IDFModel to
+ * set TF-IDF to 0.
+ */
+ if(df(j) >= minimumOccurence) {
+ inv(j) = math.log((m + 1.0)/ (df(j) + 1.0))
+ } else {
--- End diff --
else branch is not needed hers
---
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]