I want to let it select L points where : L = SQRT[number of points in data set]
That's not possible unless you compute the number of samples and its square root yourself. You can only pass an integer as n_neighbors
.
The only way to take a variable number of neighbors into account is to use RadiusNeighbors{Classifier,Regressor}
, which take a distance cutoff instead of a k parameter.