Skip to content

Commit

Permalink
Switch the comparisons.
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-iskw committed Jul 17, 2015
1 parent ca78b7d commit f397be4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ public void fitAndTransform() {
assertEquals(k, centers.length);

DataFrame transformed = model.transform(dataset);
List<String> columns = Arrays.asList(transformed.columns());
List<String> expectedColumns = Arrays.asList("features", "prediction");
for (String clm: transformed.columns()) {
assertTrue(expectedColumns.contains(clm));
for (String column: expectedColumns) {
columns.contains(column);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ class KMeansSuite extends SparkFunSuite with MLlibTestSparkContext {
assert(model.clusterCenters.length === k)

val transformed = model.transform(dataset)
transformed.columns.foreach { column =>
Array("features", predictionColName).contains(column)
val expectedColumns = Array("features", predictionColName)
expectedColumns.foreach { column =>
transformed.columns.contains(column)
}
val clusters = transformed.select(predictionColName).map(_.get(0)).distinct().collect().toSet
assert(clusters.size === k)
Expand Down

0 comments on commit f397be4

Please sign in to comment.