Skip to content

Commit 51d12c5

Browse files
authored
Merge pull request #72 from titsuki/fix-perplexity
Fix incorrect perplexity testing
2 parents 5178ced + c0d9e37 commit 51d12c5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

ml/src/test/scala/com/github/cloudml/zen/ml/clustering/LDASuite.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ class LDASuite extends FunSuite with SharedSparkContext {
5656
println((System.currentTimeMillis() - startedAt) / 1e3)
5757
pps.foreach(println)
5858

59-
val ppsDiff = pps.init.zip(pps.tail).map { case (lhs, rhs) => lhs - rhs }
59+
val ppsDiff = pps.init.zip(pps.tail).map { case (lhs, rhs) => rhs - lhs }
6060
assert(ppsDiff.count(_ > 0).toDouble / ppsDiff.length > 0.6)
61-
assert(pps.head - pps.last > 0)
61+
assert(pps.last - pps.head > 0)
6262

6363
val ldaModel = lda.toLDAModel
6464
val tempDir = Files.createTempDir()
@@ -105,9 +105,9 @@ class LDASuite extends FunSuite with SharedSparkContext {
105105
println((System.currentTimeMillis() - startedAt) / 1e3)
106106
pps.foreach(println)
107107

108-
val ppsDiff = pps.init.zip(pps.tail).map { case (lhs, rhs) => lhs - rhs }
108+
val ppsDiff = pps.init.zip(pps.tail).map { case (lhs, rhs) => rhs - lhs }
109109
assert(ppsDiff.count(_ > 0).toDouble / ppsDiff.length > 0.6)
110-
assert(pps.head - pps.last > 0)
110+
assert(pps.last - pps.head > 0)
111111

112112
val ldaModel = lda.toLDAModel.toLocalLDAModel
113113
data.collect().foreach { case (_, sv) =>
@@ -139,9 +139,9 @@ class LDASuite extends FunSuite with SharedSparkContext {
139139
println((System.currentTimeMillis() - startedAt) / 1e3)
140140
pps.foreach(println)
141141

142-
val ppsDiff = pps.init.zip(pps.tail).map { case (lhs, rhs) => lhs - rhs }
142+
val ppsDiff = pps.init.zip(pps.tail).map { case (lhs, rhs) => rhs - lhs }
143143
assert(ppsDiff.count(_ > 0).toDouble / ppsDiff.length > 0.6)
144-
assert(pps.head - pps.last > 0)
144+
assert(pps.last - pps.head > 0)
145145

146146
val ldaModel = lda.toLDAModel.toLocalLDAModel
147147
data.collect().foreach { case (_, sv) =>
@@ -173,9 +173,9 @@ class LDASuite extends FunSuite with SharedSparkContext {
173173
println((System.currentTimeMillis() - startedAt) / 1e3)
174174
pps.foreach(println)
175175

176-
val ppsDiff = pps.init.zip(pps.tail).map { case (lhs, rhs) => lhs - rhs }
176+
val ppsDiff = pps.init.zip(pps.tail).map { case (lhs, rhs) => rhs - lhs }
177177
assert(ppsDiff.count(_ > 0).toDouble / ppsDiff.length > 0.6)
178-
assert(pps.head - pps.last > 0)
178+
assert(pps.last - pps.head > 0)
179179

180180
val ldaModel = lda.toLDAModel.toLocalLDAModel
181181
data.collect().foreach { case (_, sv) =>
@@ -207,9 +207,9 @@ class LDASuite extends FunSuite with SharedSparkContext {
207207
println((System.currentTimeMillis() - startedAt) / 1e3)
208208
pps.foreach(println)
209209

210-
val ppsDiff = pps.init.zip(pps.tail).map { case (lhs, rhs) => lhs - rhs }
210+
val ppsDiff = pps.init.zip(pps.tail).map { case (lhs, rhs) => rhs - lhs }
211211
assert(ppsDiff.count(_ > 0).toDouble / ppsDiff.length > 0.6)
212-
assert(pps.head - pps.last > 0)
212+
assert(pps.last - pps.head > 0)
213213

214214
val ldaModel = lda.toLDAModel.toLocalLDAModel
215215
data.collect().foreach { case (_, sv) =>

0 commit comments

Comments
 (0)