First page Back Continue Last page Overview Graphics

Testing the Previous Solution

for i in range(n_training_samples):

neighbors = get_neighbors(learnset_data,

learnset_labels,

testset_data[i],

6,

distance=distance)

print("index: ", i,

", result of vote: ",

vote_harmonic_weights(neighbors,

all_results=True))

index: 0 , result of vote: (1, [(1, 1.0)])

index: 1 , result of vote: (2, [(2, 1.0)])

index: 2 , result of vote: (1, [(1, 1.0)])

index: 3 , result of vote: (1, [(1, 1.0)])

index: 4 , result of vote: (2, [(2, 0.9319727891156463), (1, 0.06802721088435375)])

...