Exemplo n.º 1
0
def expand(center, init_instances):
    instances_backup = list(init_instances)
    instances_backup.remove(center)

    index = instances.index(center)
    avg_distance = 0

    for b in instances_backup:
        avg_distance += distance_euclidean(center, b)
    avg_distance = avg_distance / len(instances_backup)

    for b in instances_backup:
        index_b = instances.index(b)
        kb = M[index].index(b)

        for i in range(0, kb + 1, 1):
            c = M[index_b][i]
            if c not in init_instances:
                distance = distance_euclidean(b, c)
                if distance < avg_distance:
                    init_instances.append(c)
Exemplo n.º 2
0
def test_distance():
    assert 1 == lof.distance_euclidean((1, 1), (2, 2))
Exemplo n.º 3
0
def test_distance():
    assert 1 == lof.distance_euclidean((1,1), (2,2))