• Sign Up
• Login
• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Mar 28th, 2020 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. # iterowanie po elementach ze zbioru test
2. for index_test, row_test in test.iterrows():
3.     distances_3 = [] #tablica zawierajaca odleglosci do klasy 3
4.     distances_5 = [] #tablica zawierajaca odleglosci do klasy 5
5.     #iterowanie po elementach ze zbioru train
6.     for index_train, row_train in train.iterrows():
7.         if (row_train[0]==3):
8.             distances_3.append((distance(row_test[3], row_test[10], row_train[3], row_train[10])))
9.         else:
10.             distances_5.append((distance(row_test[3], row_test[10], row_train[3], row_train[10])))
11.     np_distances_3 = np.array(distances_3)
12.     np_distances_5 = np.array(distances_5)
13.     print("dystanse do klasy 3")
14.     print(np_distances_3)
15.     print("dystanse do klasy 5")
16.     print(np_distances_5)
17.     if(np_distances_3.min()>np_distances_5.min()):
18.         if(row_test[0]==5):
19.             print("Zaklasyfikowano poprawnie")
20.         else:
21.             print("Zaklasyfikowano niepoprawnie")
22.     else:
23.         if(row_test[0]==3):
24.             print("Zaklasyfikowano poprawnie")
25.         else:
26.             print("Zaklasyfikowano niepoprawnie")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top