Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Distance matrix
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== K-Nearest Neighbors ==== A distance matrix is utilized in the [[k-NN algorithm]] which is one of the slowest but simplest and most used instance-based machine learning algorithms that can be used both in classification and regression tasks. It is one of the slowest machine learning algorithms since each test sample's predicted result requires a fully computed distance matrix between the test sample and each training sample in the training set. Once the distance matrix is computed, the algorithm selects the K number of training samples that are the closest to the test sample to predict the test sample's result based on the selected set's majority (classification) or average (regression) value. * Prediction time complexity is <math>O(k * n * d)</math>, to compute the distance between each test sample with every training sample to construct the distance matrix where: # k = number of nearest neighbors selected # n = size of the training set # d = number of dimensions being used for the data This classification focused model predicts the label of the target based on the distance matrix between the target and each of the training samples to determine the K-number of samples that are the closest/nearest to the target. {{Photo montage| | photo1a =DistanceMatrix_KNN.png{{!}}The distance matrix used to select K train samples for K-nn | photo1b =K_nearestNeighborVisual.png{{!}}Machine Learning model predicting target value with K-NN | size = 650 | border = 0 | color = transparent }}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)