Skip to content

Commit b9864b2

Browse files
authored
Update README.rst
1 parent f6e680c commit b9864b2

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

README.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,25 @@ words in documents
476476
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
477477
K-nearest Neighbor
478478
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
479+
R
480+
In machine learning, the k-nearest neighbors algorithm (kNN)
481+
is a non-parametric technique used for classification.
482+
This method is used in Natural-language processing (NLP)
483+
as text classification in many researches in past
484+
decad
479485

480486
.. image:: docs/pic/KNN.png
481487

488+
.. code:: python
489+
490+
#load data
491+
from sklearn.neighbors import KNeighborsClassifier
492+
neigh = KNeighborsClassifier(n_neighbors=number_of_classes)
493+
neigh.fit(Xtrain, ytrain)
494+
new_y = neigh.predict(Xtext)
495+
496+
497+
482498
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
483499
Support Vector Machine~(SVM)
484500
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)