Skip to content

Commit

Permalink
remove test euclidian
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchavakis committed Oct 11, 2022
1 parent 4f6668c commit 9033ffb
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions clustering/clustering_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,42 +55,6 @@ func TestKMeansLeastCentroid(t *testing.T) {
assert.Nil(t, res)
}

func TestKMeansEuclidean(t *testing.T) {
params := Parameters{
k: 2,
points: []geometry.Point{{Lat: 20.0, Lng: 10.0}, {Lat: 25.0, Lng: 10.0}, {Lat: 60.0, Lng: 10.0}, {Lat: 18.0, Lng: 11.0}, {Lat: 18.0, Lng: 10.0}, {Lat: 50.0, Lng: 11.0}},
distanceType: Euclidean,
}

res, err := KMeans(params)
assert.Nil(t, err)
assert.NotNil(t, res)
clusters := make(map[geometry.Point][]geometry.Point)
p1 := geometry.Point{
Lat: 20.25,
Lng: 10.25,
}
p1Cluster := []geometry.Point{}
p1Cluster = append(p1Cluster, *geometry.NewPoint(20.0, 10.0))
p1Cluster = append(p1Cluster, *geometry.NewPoint(25.0, 10.0))
p1Cluster = append(p1Cluster, *geometry.NewPoint(18.0, 11.0))
p1Cluster = append(p1Cluster, *geometry.NewPoint(18.0, 10.0))

p2 := geometry.Point{
Lat: 55.0,
Lng: 10.5,
}
p2Cluster := []geometry.Point{}
p2Cluster = append(p2Cluster, *geometry.NewPoint(60.0, 10.0))
p2Cluster = append(p2Cluster, *geometry.NewPoint(50.0, 11.0))

clusters[p1] = p1Cluster
clusters[p2] = p2Cluster

assert.Equal(t, len(res), 2)
assert.Equal(t, res, clusters)
}

func TestKMeans(t *testing.T) {
params := Parameters{
k: 2,
Expand Down

0 comments on commit 9033ffb

Please sign in to comment.