Skip to content

Commit 9155755

Browse files
authored
Add files via upload
1 parent 96b8f23 commit 9155755

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.thealgorithms.backtracking;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
5+
import java.util.List;
6+
import org.junit.jupiter.api.Test;
7+
8+
public class KMeansTest {
9+
10+
@Test
11+
void testSimpleKMeans() {
12+
KMeans kMeans = new KMeans();
13+
14+
double[][] data = {
15+
{1.0, 2.0}, {1.5, 1.8}, {5.0, 8.0}, {8.0, 8.0},
16+
{1.0, 0.6}, {9.0, 11.0}, {8.0, 2.0}, {10.0, 2.0}, {9.0, 3.0}
17+
};
18+
19+
List<List<double[]>> clusters = kMeans.kMeans(data, 2, 100);
20+
assertEquals(2, clusters.size());
21+
}
22+
}

0 commit comments

Comments
 (0)