generated from LufsX/Experiment-kNN
This commit is contained in:
+1
-17
@@ -116,20 +116,4 @@ test_data, test_labels = load_dataset('C:\\Users\\Administrator\\Desktop\\testDi
|
||||
for i in range(len(test_data)):
|
||||
predicted_label = knn_classify(test_data[i], train_data, train_labels, k=3)
|
||||
true_label = test_labels[i]
|
||||
print(f"预测标签: {predicted_label}, 真实标签: {true_label}")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"00000000000001111111110000000000"
|
||||
"00000000000000000111100000000000"
|
||||
)
|
||||
predicted_label = classify(
|
||||
np.array([int(char) for char in test_data]).reshape(1, 1024),
|
||||
train_data,
|
||||
train_labels,
|
||||
)
|
||||
|
||||
print(f"预测的标签: {predicted_label}")
|
||||
print(f"预测标签: {predicted_label}, 真实标签: {true_label}")
|
||||
Reference in New Issue
Block a user