/// <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="Accord.Math.Distance.SquareEuclidean(double[], double[])"/> distance.</param> /// public KModes(int k, Func <TData, TData, 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 <TData>(k, distance); }
/// <summary> /// Initializes a new instance of KModes 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="Accord.Math.Distance.SquareEuclidean(double[], double[])"/> distance.</param> /// public KModes(int k, IDistance <T[]> 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-modes' clusters. this.clusters = new KModesClusterCollection <T>(k, distance); this.Initialization = Seeding.KMeansPlusPlus; this.Tolerance = 1e-5; this.MaxIterations = 100; }
/// <summary> /// Initializes a new instance of the <see cref="KModesCluster<TData>"/> class. /// </summary> /// /// <param name="owner">The owner.</param> /// <param name="index">The cluster index.</param> /// public KModesCluster(KModesClusterCollection <TData> owner, int index) { this.owner = owner; this.index = index; }
/// <summary> /// Initializes a new instance of the <see cref="KModesCluster"/> class. /// </summary> /// /// <param name="owner">The owner collection.</param> /// <param name="index">The cluster index.</param> /// public KModesCluster(KModesClusterCollection <T> owner, int index) : base(owner, index) { }