kmeans.py
def update_centers(data_set, assignments):
    """
    Accepts a dataset and a list of assignments; the indexes
    of both lists correspond to each other.
    Compute the center for each of the assigned groups.
    Return `k` centers where `k` is the number of unique assignments.
    """
    new_means = defaultdict(list)
    centers = []
    for assignment, point in zip(assignments, data_set):
        new_means[assignment].append(point)

    for points in new_means.itervalues():
        centers.append(point_avg(points))

    return centers

    Accepts a dataset and a list of assignments; the indexes
    of both lists correspond to each other.
    Compute the center for each of the assigned groups.
    Return `k` centers where `k` is the number of unique assignments.
    
Accepts a dataset and a list of assignments; the indexes
of both lists correspond to each other.
Compute the center for each of the assigned groups.
Return `k` centers where `k` is the number of unique assignments.
Accepts a dataset and a list of assignments ; the indexes of both lists correspond to each other . Compute the center for each of the assigned groups . Return ` k ` centers where ` k ` is the number of unique assignments .
def update_centers(data_set, assignments):
    new_means = defaultdict(list)
    centers = []
    for assignment, point in zip(assignments, data_set):
        new_means[assignment].append(point)
    for points in new_means.itervalues():
        centers.append(point_avg(points))
    return centers
def update_centers ( data_set , assignments ) : new_means = defaultdict ( list ) centers = [ ] for assignment , point in zip ( assignments , data_set ) : new_means [ assignment ] . append ( point ) for points in new_means . itervalues ( ) : centers . append ( point_avg ( points ) ) return centers
Accepts a dataset and a list of assignments; the indexes
of both lists correspond to each other.
Accepts a dataset and a list of assignments ; the indexes of both lists correspond to each other .
"""
    Accepts a dataset and a list of assignments; the indexes
    of both lists correspond to each other.
    Compute the center for each of the assigned groups.
    Return `k` centers where `k` is the number of unique assignments.
    """
data_set
assignments