Created
October 3, 2021 11:15
-
-
Save saurbhc/51b5c3c032ef5801882d2c4c53c28a84 to your computer and use it in GitHub Desktop.
k-nearest-neighbor Algorithm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
k_in_knn_value, number_of_vectors, from_vector, to_vector, euclidean_distance_df = get_input() | |
knn_obj = KNearestNeighborsAlgorithm(_k_in_knn_value=k_in_knn_value, _euclidean_distance_df=euclidean_distance_df) | |
knn_distance = knn_obj.execute() | |
print(f""" | |
>> {k_in_knn_value}-Nearest-Neighbours are: {knn_distance.head(k_in_knn_value).Label.tolist()} | |
>> Most Common Label is: {most_common(knn_distance.head(k_in_knn_value).Label.tolist())} | |
""") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment