示例#1
0
        /// <summary>
        ///   Initializes a new instance of KMeans algorithm
        /// </summary>
        ///
        /// <param name="k">The number of clusters to divide input data.</param>
        /// <param name="distance">The distance function to use. Default is to
        /// use the <see cref="BestCS.Math.Distance.SquareEuclidean(double[], double[])"/> distance.</param>
        ///
        public KModes(int k, Func <T[], T[], double> distance)
        {
            if (k <= 0)
            {
                throw new ArgumentOutOfRangeException("k");
            }

            if (distance == null)
            {
                throw new ArgumentNullException("distance");
            }

            // Create the object-oriented structure to hold
            //  information about the k-means' clusters.
            this.clusters = new KModesClusterCollection <T>(k, distance);
        }
示例#2
0
 /// <summary>
 ///   Initializes a new instance of the <see cref="KModesCluster&lt;T&gt;"/> class.
 /// </summary>
 ///
 /// <param name="owner">The owner.</param>
 /// <param name="index">The cluster index.</param>
 ///
 public KModesCluster(KModesClusterCollection <T> owner, int index)
 {
     this.owner = owner;
     this.index = index;
 }