Beispiel #1
0
        static List <double> GaussianRadiusDistances(int n, int dimensions, int maxCoordinate, int sigma)
        {
            var center          = Enumerable.Range(0, dimensions).Select(i => maxCoordinate / 2).ToArray();
            var deviations      = Enumerable.Range(0, dimensions).Select(i => (double)sigma).ToArray();
            var affectedIndices = Enumerable.Range(0, dimensions).ToArray();
            var generator       = new EllipsoidalGenerator(center, deviations, affectedIndices);
            var tempPoint       = new int[dimensions];
            var centerPoint     = new UnsignedPoint(center);
            var points          = Enumerable.Range(0, n).Select(i => new UnsignedPoint(generator.Generate(tempPoint))).ToList();
            var distances       = points.Select(p => centerPoint.Distance(p)).OrderBy(dist => dist).ToList();

            return(distances);
        }
Beispiel #2
0
        public ClusterRadius(IList <UnsignedPoint> points)
        {
            Centroid = UnsignedPoint.Centroid(points);
            var radiusSum = 0.0;

            MaximumRadius = 0;
            foreach (var point in points)
            {
                var distance = Centroid.Distance(point);
                MaximumRadius = Math.Max(MaximumRadius, distance);
                radiusSum    += distance;
            }
            if (points.Count > 0)
            {
                MeanRadius = radiusSum / points.Count;
            }
        }