`sklearn.neighbors.NearestNeighbors` allow processing nan values

### Describe the workflow you want to enable

In some cases (for example [memory-based collaborative filtering](https://en.wikipedia.org/wiki/Collaborative_filtering)) empty values is important part of the algorithm. But `sklearn.neighbors.NearestNeighbors` doesn't allow to handle empty values, even if metrics can handle such cases.

The following code snippet shows a simple realisation of building collaboration with `sklearn.neighbors.NearestNeighbors`.
```py
import numpy as np
from sklearn.neighbors import NearestNeighbors
from scipy.spatial.distance import correlation as orig_correlation

def correlation(a,b):
    '''
    Modified correlation function that handles
    nan values. If it's impossible to
    to calculate the distance, it returns 2 - 
    the maximum possible value.
    '''
    cond = ~(np.isnan(a) | np.isnan(b))
    # in case if there are only two
    # observations it's impossible
    # to compute coorrelation coeficient
    # it's invalid case - so we return 
    # the biggest possible distance
    if sum(cond) <=1:
        return 2

    a_std = a[cond].std()
    b_std = b[cond].std()

    # Pearson coefficient uses standard 
    # deviations in the denominator, so 
    # if any of them is equal to zero, 
    # we have to return the biggest
    # possible distance.
    if a_std==0 or b_std==0:
        return 2
    return orig_correlation(a[cond],b[cond])

example_array = np.array(
    [[ 5.,  2.,  4.,  6.,  5.,  4.,  6.,  6.,  7.,  6.],
    [ 6., np.NaN,  4.,  7.,  5.,  4.,  8.,  5.,  7.,  6.],
    [ 7., 10.,  1., np.NaN,  9.,  7., np.NaN,  3., np.NaN,  8.],
    [np.NaN,  2.,  4., np.NaN,  4.,  4.,  7.,  7., np.NaN,  6.],
    [ 8.,  1., np.NaN,  7.,  6.,  2.,  2.,  8.,  2.,  1.],
    [ 8., np.NaN, np.NaN, np.NaN,  8.,  7.,  7.,  4., 10.,  9.],
    [ 8.,  1.,  6.,  8.,  5.,  2.,  2., np.NaN,  3.,  1.],
    [ 6., np.NaN,  0.,  5.,  9.,  7.,  7.,  3.,  9.,  6.],
    [np.NaN,  1.,  7.,  8.,  5.,  2., np.NaN, np.NaN, np.NaN,  1.],
    [ 8.,  1.,  7.,  8.,  5., np.NaN,  2.,  8.,  3.,  1.]]
)

NearestNeighbors(
    metric=correlation
).fit(example_array)
```
It raises `ValueError: Input X contains NaN.`. You can see from the trace that it just happens during the data validation phase - `sklearn/utils/validation.py`, function `_assert_all_finite`.

It would be great if you could use data with empty values in some cases.

### Describe your proposed solution

This can be solved by adding a parameter to `sklearn.neighbors.NearestNeighbors` that allows to use empty values in the algorithm. If this parameter is set to `True`, validation functions won't throw errors if array with nan is passed.

### Describe alternatives you've considered, if relevant

_No response_

### Additional context

_No response_

COMMENT:
@durga0201 not support your idea. It would be advantageous to have an option to define a custom metric that handles empty positions in a specific way. To achieve this, it is necessary to provide the ability to identify which positions were empty and which were not within the function passed as the `metric` attribute. Now passing arrays with empty values just causes an error that stops the programme.

Labels: New Feature