Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -81,12 +81,10 @@ def KNN_predict(train_features, train_labels, test_feature, K):
|
|
| 81 |
label_record = []
|
| 82 |
for i in range(len(train_features)):
|
| 83 |
train_point_feature = train_features[i]
|
| 84 |
-
test_point_feature = test_feature
|
| 85 |
### (1) calculate distance between test feature and each of training data points
|
| 86 |
|
| 87 |
-
# get distance for data point i
|
| 88 |
-
print("train_point_feature: ",train_point_feature.shape)
|
| 89 |
-
print("test_point_feature: ",test_point_feature.shape)
|
| 90 |
dis = scipy.spatial.distance.euclidean(train_point_feature, test_point_feature)
|
| 91 |
|
| 92 |
# collect lable for datapoint i
|
|
|
|
| 81 |
label_record = []
|
| 82 |
for i in range(len(train_features)):
|
| 83 |
train_point_feature = train_features[i]
|
| 84 |
+
test_point_feature = test_feature.flatten()
|
| 85 |
### (1) calculate distance between test feature and each of training data points
|
| 86 |
|
| 87 |
+
# get distance for data point i
|
|
|
|
|
|
|
| 88 |
dis = scipy.spatial.distance.euclidean(train_point_feature, test_point_feature)
|
| 89 |
|
| 90 |
# collect lable for datapoint i
|