예제 #1
0
        /// <summary>
        ///   Computes the distortion of the cluster, measured
        ///   as the average distance between the cluster points
        ///   and its centroid.
        /// </summary>
        ///
        /// <param name="data">The input points.</param>
        ///
        /// <returns>The average distance between all points
        /// in the cluster and the cluster centroid.</returns>
        ///
        public double Distortion(TData[] data)
        {
            TData centroid = Mode;

            double error = 0.0;

            for (int i = 0; i < data.Length; i++)
            {
                error += owner.Distance(data[i], centroid);
            }
            return(error / (double)data.Length);
        }
예제 #2
0
        /// <summary>
        ///   Computes the distortion of the cluster, measured
        ///   as the average distance between the cluster points
        ///   and its centroid.
        /// </summary>
        ///
        /// <param name="points">The input points.</param>
        ///
        /// <returns>The average distance between all points
        /// in the cluster and the cluster centroid.</returns>
        ///
        public double Distortion(T[][] points)
        {
            T[] centroid = Mode;

            double error = 0.0;

            for (int i = 0; i < points.Length; i++)
            {
                error += owner.Distance(points[i], centroid);
            }
            return(error / (double)points.Length);
        }