Exemplo n.º 1
0
        private List <Kmeans <PointType> > RecursiveProcessing(Kmeans <PointType> parent,
                                                               List <Kmeans <PointType> > register)
        {
            var children = (from __k in Enumerable.Range(0, _k)
                            select  new Kmeans <PointType>(_k, parent.ClusterPoints.Where(x => x.ClusterIndex == __k).Select(x => x.Point).ToList())).ToList();

            foreach (var child in children)
            {
                child.Calculation(1);
            }
            var selectedChild = false;

            for (var i = 0; i < _k && !selectedChild; i++)
            {
                var child = children[i];
                if (parent.CenterDistDispersion[i] > child.CenterDistDispersion.Sum() &&
                    child.ClusterPoints.Count > 1)
                {
                    RecursiveProcessing(child, register);
                }
                else
                {
                    register.Add(child);
                }
            }

            return(register);
        }
Exemplo n.º 2
0
 public Xmeans(List <PointType> points)
 {
     TopKm = new Kmeans <PointType>(_k, points);
 }