public void UpdateCentroids()  // обновление списка центроидов - запись центроидов из каждого кластера в Centroids
 {
     Centroids.Clear();
     foreach (var c in Clusters)
     {
         Centroids.Add(c.Centroid);
     }
 }
Exemple #2
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    Centroids.Clear();
                    Centroids = null;
                }
                disposedValue = true;
            }
        }
Exemple #3
0
        public void GenrateCentroids(int _centoridsNumber)
        {
            MaxCentroidShift = 1;
            Centroids.Clear();
            _excludedSampleIndexes.Clear();
            for (int i = 0; i < _centoridsNumber; i++)
            {
                int choosenSampleIndex;

                do
                {
                    choosenSampleIndex = Random.Next(SamplePoints.Count);
                } while (_excludedSampleIndexes.Contains(choosenSampleIndex));

                Centroids.Add(new Centroid(SamplePoints[choosenSampleIndex]));
                _excludedSampleIndexes.Add(choosenSampleIndex);
            }
        }
Exemple #4
0
        public void GenerateCentroids()
        {
            Centroids.Clear();
            List <int> excludedSampleIndexes = new List <int>();

            for (int i = 0; i < HiddenNeuronsNumber; i++)
            {
                int choosenSampleIndex;

                do
                {
                    choosenSampleIndex = Random.Next(SamplePoints.Count);
                } while (excludedSampleIndexes.Contains(choosenSampleIndex));

                Centroids.Add(
                    new Centroid(choosenSampleIndex, SamplePoints[choosenSampleIndex]));
                excludedSampleIndexes.Add(choosenSampleIndex);
            }
        }