Scikit-learn k-Nearest Neighbors

Create k-Nearest Neighbors (k-NN) model for classification or regression. The performance of this model mainly depends on number of neighbors and metric used to compute distance. After model creation please fit it with data.


Required packages

You need below packages to use the code generated by recipe. All packages are automatically installed in MLJAR Studio.


Interactive recipe

You can use below interactive recipe to generate code. This recipe is available in MLJAR Studio.

Python code

# Python code will be here

Code explanation

Create model for training with k-Nearest Neighbors algorithm. The speed of training greatly depends on data size, both on rows and columns number.

« Previous
Random Forest