Exemplo n.º 1
0
        /*
         * public void calculateSilhouette()
         * {
         *  customerSillhouette = (MeanNeighbhourCluster.Min(x => x.Item2) - MeanMyCluster) / CalculatMax(MeanMyCluster, MeanNeighbhourCluster) == double.NaN ? 0
         *      : (MeanNeighbhourCluster.Min(x => x.Item2) - MeanMyCluster) / CalculatMax(MeanMyCluster, MeanNeighbhourCluster);
         * }
         *
         * public double CalculatMax(double mycluster, List<Tuple<int, double>> neighbourCluster)
         * {
         * return mycluster > neighbourCluster.Min(x => x.Item2) ? mycluster : MeanNeighbhourCluster.Min(x => x.Item2);
         * }
         */

        public void calculateSilhouette()
        {
            double cohesion   = MeanMyCluster;
            double seperation = MeanNeighbhourCluster.Min(x => x.Item2);

            if (cohesion < seperation)
            {
                customerSillhouette = 1 - (cohesion / seperation);
            }
            else if (cohesion > seperation)
            {
                customerSillhouette = (seperation / cohesion) - 1;
            }
            else
            {
                customerSillhouette = 0;
            }
        }
Exemplo n.º 2
0
 public void AddNeighbhour(Tuple <int, double> neighbour)
 {
     MeanNeighbhourCluster.Add(neighbour);
 }