Skip to content

Commit

Permalink
Remove unnecessary toDouble's from IDFSuite
Browse files Browse the repository at this point in the history
  • Loading branch information
rnowling committed Sep 23, 2014
1 parent bfa82ec commit e6523a8
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class IDFSuite extends FunSuite with LocalSparkContext {
val idf = new IDF
val model = idf.fit(termFrequencies)
val expected = Vectors.dense(Array(0, 3, 1, 2).map { x =>
math.log((m.toDouble + 1.0) / (x + 1.0))
math.log((m + 1.0) / (x + 1.0))
})
assert(model.idf ~== expected absTol 1e-12)
val tfidf = model.transform(termFrequencies).cache().zipWithIndex().map(_.swap).collectAsMap()
Expand Down Expand Up @@ -68,7 +68,7 @@ class IDFSuite extends FunSuite with LocalSparkContext {
val model = idf.fit(termFrequencies)
val expected = Vectors.dense(Array(0, 3, 1, 2).map { x =>
if (x > 0) {
math.log((m.toDouble + 1.0) / (x + 1.0))
math.log((m + 1.0) / (x + 1.0))
} else {
0
}
Expand Down

0 comments on commit e6523a8

Please sign in to comment.