Skip to content

Commit a200bab

Browse files
committed
Remove unnecessary else statement
1 parent 4b974f5 commit a200bab

File tree

1 file changed

+3
-2
lines changed
  • mllib/src/main/scala/org/apache/spark/mllib/feature

1 file changed

+3
-2
lines changed

mllib/src/main/scala/org/apache/spark/mllib/feature/IDF.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,12 @@ private object IDF {
139139
* number of documents, set IDF to 0. This
140140
* will cause multiplication in IDFModel to
141141
* set TF-IDF to 0.
142+
*
143+
* Since arrays are initialized to 0 by default,
144+
* we just omit changing those entries.
142145
*/
143146
if(df(j) >= minimumOccurence) {
144147
inv(j) = math.log((m + 1.0)/ (df(j) + 1.0))
145-
} else {
146-
inv(j) = 0.0
147148
}
148149
j += 1
149150
}

0 commit comments

Comments
 (0)