Skip to content

K-Nearest Neighbors algorithm for classification and regression implemented from scratch

Notifications You must be signed in to change notification settings

hhuang5163/K-NearestNeighbors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

K-NearestNeighbors

K-Nearest Neighbors for classification and regression implemented from scratch. -Hyperparameter tuning was done to determine the best value of K that yields the lowest test error. -Tested on the make classification (random 2-class classification problem) and moons datasets from scikit-learn. -Accuracy was tested against the scikit-learn built-in KNeighborsClassifier and KNeighborsRegressor.

200 samples from each dataset were generated and randomly split into training and testing datasets. Training and testing error for varying values of the hyperparameter K as well as the classifications and regression visualizations can be found in the corresponding results folder.

All code is in the knn.py file. Simply run the file to reproduce the results.

About

K-Nearest Neighbors algorithm for classification and regression implemented from scratch

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages