notes

Personal notes
git clone git://git.laack.co/notes.git
Log | Files | Refs

KNearestNeighbor.md (559B)


      1 # k Nearest Neighbor
      2 
      3 ML CH1
      4 
      5 **Definition:** k nearest neighbor is the idea of using the k nearest elements of some set to derive some information. 
      6 
      7 In ml, this can be used used to find the k nearest neighbor regression of a sample using an instance based approach where you would find the k nearest values and average them. This would then be the prediction for the sample. 
      8 
      9 Using sklearn you can specify to load k nearest neighbor as follows:
     10 
     11 ```python
     12 
     13 from sklearn.neighbors import KNeighboarsRegressor
     14 model = KNeighborsRegressor(n_neighbors=3)
     15 
     16 ```