[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. Essentially what the proposal here would be equivalent to if you wanted to adopt an imputation viewpoint would be dynamic imputation within each node/leaf of a value such that the mean penalty within that leaf is unchanged for the output in question. 
1. Imputation is a possible solution to problems of missing data but you need to be careful about why the data is missing. For example if a have a systematic reason that I can't measure outcome y_i for inputs in a subspace X' then imputing the median for y_i will bias the model. 
1. If there's a response to the RFC there's zero-chance the default will be to ignore as default rather than continue to raise as default.
1. This only concerns the output labels y, you would need to have a dense set of input features X.

Labels: New Feature