Encog.ML.Kmeans.Centroid.CalcCentroid C# (CSharp) Méthode

CalcCentroid() public méthode

Calculate the centroid.
public CalcCentroid ( ) : void
Résultat void
        public void CalcCentroid()
        {
            // only called by CAInstance
            int numDp = _cluster.Size();

            var temp = new double[_centers.Length];

            // caluclating the new Centroid
            for (int i = 0; i < numDp; i++)
            {
                for (int j = 0; j < temp.Length; j++)
                {
                    temp[j] += _cluster.Get(i)[j];
                }
            }

            for (int i = 0; i < temp.Length; i++)
            {
                _centers[i] = temp[i]/numDp;
            }

            _cluster.CalcSumOfSquares();
        }
    }