[RFC] Allow handling of NaNs in multi-task Random Forests

### Describe the workflow you want to enable

 Currently the RFR implementation is only capable of handling dense multi-task problems is there any scope to change the underlying algorithm to handle NaNs as a special case or would this break the API given that it might extend to allowing NaNs in the single class case? 

The hypothesis is that I may benefit from knowing the information about the available labels in the multi-task model even though I am missing labels for some tasks.

### Describe your proposed solution

boolean flag in the constructor that allows NaNs to be ignored when calculating the impurity.

### Describe alternatives you've considered, if relevant

_No response_

### Additional context

```python
>>> import numpy as np
>>> from sklearn.ensemble import RandomForestRegressor
>>> rfr=RandomForestRegressor()
>>> X = np.random.randn(5,10)
>>> y = np.random.randn(5,2)
>>> y[4,1]=np.nan
>>> rfr.fit(X, y)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/chemix-rhys/opt/miniconda3/envs/chemix-py310/lib/python3.10/site-packages/sklearn/base.py", line 1151, in wrapper
    return fit_method(estimator, *args, **kwargs)
  File "/Users/chemix-rhys/opt/miniconda3/envs/chemix-py310/lib/python3.10/site-packages/sklearn/ensemble/_forest.py", line 348, in fit
    X, y = self._validate_data(
  File "/Users/chemix-rhys/opt/miniconda3/envs/chemix-py310/lib/python3.10/site-packages/sklearn/base.py", line 621, in _validate_data
    X, y = check_X_y(X, y, **check_params)
  File "/Users/chemix-rhys/opt/miniconda3/envs/chemix-py310/lib/python3.10/site-packages/sklearn/utils/validation.py", line 1163, in check_X_y
    y = _check_y(y, multi_output=multi_output, y_numeric=y_numeric, estimator=estimator)
  File "/Users/chemix-rhys/opt/miniconda3/envs/chemix-py310/lib/python3.10/site-packages/sklearn/utils/validation.py", line 1173, in _check_y
    y = check_array(
  File "/Users/chemix-rhys/opt/miniconda3/envs/chemix-py310/lib/python3.10/site-packages/sklearn/utils/validation.py", line 959, in check_array
    _assert_all_finite(
  File "/Users/chemix-rhys/opt/miniconda3/envs/chemix-py310/lib/python3.10/site-packages/sklearn/utils/validation.py", line 124, in _assert_all_finite
    _assert_all_finite_element_wise(
  File "/Users/chemix-rhys/opt/miniconda3/envs/chemix-py310/lib/python3.10/site-packages/sklearn/utils/validation.py", line 173, in _assert_all_finite_element_wise
    raise ValueError(msg_err)
ValueError: Input y contains NaN.
```

COMMENT:
1) yes all observables measured for all points.
2) https://stats.stackexchange.com/questions/98953/why-doesnt-random-forest-handle-missing-values-in-predictors There are lots of opinions about different approaches here. I tend to favor the idea of just ignoring the nans in any split and then propagating the data points with nans into both leaves. I guess there's a potential numerical problem that might arise with that due to there potentially being exponential growth in the number of data points being tracked hence why other approaches may be better given the need to scale to O(10^6) points in sklearn.

Labels: New Feature