{"push_id":2723080758,"size":1,"distinct_size":1,"ref":"refs/heads/master","head":"c677aa3ef012353acd662485872f4518b19d05a0","before":"53252c2c5e384afa55126e019632cbfcac26d978","commits":[{"sha":"c677aa3ef012353acd662485872f4518b19d05a0","author":{"name":"Suraj Negi","email":"2b26edd0ec13833cc65ff229091f7a0917629c7b@gmail.com"},"message":"Add files via upload\n\nK nearest neighbors is a simple algorithm that stores all available cases and classifies new cases based on a similarity measure (e.g., distance functions). KNN has been used in statistical estimation and pattern recognition already in the beginning of 1970's as a non-parametric technique.\r\n\r\nAlgorithm\r\n1.. Load the data\r\n2.. Initialise the value of k\r\n3.. For getting the predicted class, iterate from 1 to total number of training data points\r\n    1.. Calculate the distance between test data and each row of training data. Here we will use Euclidean distance as our           distance metric since it’s the most popular method. The other metrics that can be used are Chebyshev, cosine, etc.\r\n    2.. Sort the calculated distances in ascending order based on distance values\r\n    3.. Get top k rows from the sorted array\r\n    4.. Get the most frequent class of these rows\r\n    5.. Return the predicted class\r\n    \r\nChoosing the number of nearest neighbors i.e. determining the value of k plays a significant role in determining the efficacy of the model. Thus, selection of k will determine how well the data can be utilized to generalize the results of the kNN algorithm. A large k value has benefits which include reducing the variance due to the noisy data; the side effect being developing a bias due to which the learner tends to ignore the smaller patterns which may have useful insights.","distinct":true,"url":"https://api.github.com/repos/surajn581/machine_learning/commits/c677aa3ef012353acd662485872f4518b19d05a0"}]}
{"actor":{"display_login":"surajn581"}}