public void ClusterizeTests() { var cl = new Clarans(); var v1 = new List <double> { 1, 1, 1 }; var v2 = new List <double> { 2, 2, 2 }; var v3 = new List <double> { 8, 8, 8 }; var v4 = new List <double> { 9, 9, 9 }; var medoids = new List <List <double> > { v1, v3 }; var vectors = new List <List <double> > { v1, v2, v3, v4 }; var clusters = cl.Clusterize(medoids, vectors); Assert.Equal(2, clusters.Keys.Count); Assert.Equal(2, clusters[v1].Count); Assert.Equal(2, clusters[v3].Count); }
public void ComputeCostTests() { var cl = new Clarans(); var v1 = new List <double> { 1, 1, 1 }; var v2 = new List <double> { 2, 2, 2 }; var v3 = new List <double> { 8, 8, 8 }; var v4 = new List <double> { 9, 9, 9 }; var medoids = new List <List <double> > { v1, v3 }; var vectors = new List <List <double> > { v1, v2, v3, v4 }; var clusters = cl.Clusterize(medoids, vectors); var cost = cl.ComputeCost(clusters); Assert.Equal(2 * Math.Sqrt(3), cost); }