algorithms/k-means/algorithms.py
def update_centers(this):
        """
        Choose new center for each cluster. Compute the average, then chose the closest to the average.
        :return: None
        """
        for i in range(this.k):
            # Return the closest point to the average in this.clusters[i].
            B = this._average(this.clusters[i], this.data_type)  # Barycenter for points, else average word
            distances = [this.distance(this.clusters[i][j], B) for j in range(len(this.clusters[i]))]
            this.centers[i] = this.clusters[i][np.argmin(distances)]

        Choose new center for each cluster. Compute the average, then chose the closest to the average.
        :return: None
        
Choose new center for each cluster. Compute the average, then chose the closest to the average.
Choose new center for each cluster . Compute the average then chose the closest to the average .
def update_centers(this):
        for i in range(this.k):
            B = this._average(this.clusters[i], this.data_type)  
            distances = [this.distance(this.clusters[i][j], B) for j in range(len(this.clusters[i]))]
            this.centers[i] = this.clusters[i][np.argmin(distances)]
def update_centers ( this ) : for i in range ( this . k ) : B = this . _average ( this . clusters [ i ] , this . data_type ) distances = [ this . distance ( this . clusters [ i ] [ j ] , B ) for j in range ( len ( this . clusters [ i ] ) ) ] this . centers [ i ] = this . clusters [ i ] [ np . argmin ( distances ) ]
Choose new center for each cluster.
Choose new center for each cluster .
"""
        Choose new center for each cluster. Compute the average, then chose the closest to the average.
        :return: None
        """ # Return the closest point to the average in this.clusters[i]. # Barycenter for points, else average word
None
this