error: 'i' format requires -2147483648 <= number <= 2147483647

### Describe the bug

```python
from sklearn.ensemble import RandomForestClassifier
from sklearn.multioutput import MultiOutputClassifier
from sklearn.model_selection import train_test_split

from sklearn import preprocessing
from sklearn import utils

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.4, random_state=4)

clf = RandomForestClassifier(random_state=1)
mtf = MultiOutputClassifier(clf, n_jobs=-1)
mtf.fit(X_train, y_train)
y_pred = mtf.predict(X_test)
```

This is what my X and y data look like (column headers not included):


```
0	2001.0	12403	18925	1809	117548	13885	27013	3868	6.0	21.0	2500.0
1	1996.0	2811	19505	3412	117548	13885	3796	785	6.0	21.0	2500.0
2	2014.0	4764	3186	13	117548	69144	12998	22353	4.0	38.0	37500.0
4	2011.0	6765	18930	2941	117548	69144	36573	24632	4.0	29.0	17500.0
5	2009.0	6140	7999	1553	117548	66022	36573	15095	6.0	27.0	7500.0
```

This it what it looks like when I use np.vstack on the values:


```
array([[2.0010e+03, 1.2403e+04, 1.8925e+04, ..., 6.0000e+00, 2.1000e+01,
        2.5000e+03],
       [1.9960e+03, 2.8110e+03, 1.9505e+04, ..., 6.0000e+00, 2.1000e+01,
        2.5000e+03],
       [2.0140e+03, 4.7640e+03, 3.1860e+03, ..., 4.0000e+00, 3.8000e+01,
        3.7500e+04],
       ...,
       [2.0040e+03, 9.5270e+03, 1.5912e+04, ..., 4.0000e+00, 3.0000e+01,
        2.5000e+03],
       [2.0060e+03, 8.5680e+03, 2.1500e+03, ..., 8.0000e+00, 1.9000e+01,
        1.2500e+04],
       [2.0090e+03, 1.0900e+04, 7.9990e+03, ..., 8.0000e+00, 2.5000e+01,
        1.7500e+04]])
```

This is the error:

```pytb
---------------------------------------------------------------------------
_RemoteTraceback                          Traceback (most recent call last)
_RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/joblib/externals/loky/process_executor.py", line 357, in _sendback_result
    exception=exception))
  File "/opt/conda/lib/python3.7/site-packages/joblib/externals/loky/backend/queues.py", line 247, in put
    self._writer.send_bytes(obj)
  File "/opt/conda/lib/python3.7/multiprocessing/connection.py", line 200, in send_bytes
    self._send_bytes(m[offset:offset + size])
  File "/opt/conda/lib/python3.7/multiprocessing/connection.py", line 393, in _send_bytes
    header = struct.pack("!i", n)
struct.error: 'i' format requires -2147483648 <= number <= 2147483647
"""

The above exception was the direct cause of the following exception:

error                                     Traceback (most recent call last)
/tmp/ipykernel_27/516041905.py in <module>
     25 # Training the model on the training dataset
     26 # fit function is used to train the model using the training sets as parameters
---> 27 mtf.fit(X_train, y_train)
     28 # performing predictions on the test dataset
     29 y_pred = mtf.predict(X_test)

/opt/conda/lib/python3.7/site-packages/sklearn/multioutput.py in fit(self, X, Y, sample_weight, **fit_params)
    432             Returns a fitted instance.
    433         """
--> 434         super().fit(X, Y, sample_weight, **fit_params)
    435         self.classes_ = [estimator.classes_ for estimator in self.estimators_]
    436         return self

/opt/conda/lib/python3.7/site-packages/sklearn/multioutput.py in fit(self, X, y, sample_weight, **fit_params)
    204                 self.estimator, X, y[:, i], sample_weight, **fit_params_validated
    205             )
--> 206             for i in range(y.shape[1])
    207         )
    208 

/opt/conda/lib/python3.7/site-packages/joblib/parallel.py in __call__(self, iterable)
   1052 
   1053             with self._backend.retrieval_context():
-> 1054                 self.retrieve()
   1055             # Make sure that we get a last message telling us we are done
   1056             elapsed_time = time.time() - self._start_time

/opt/conda/lib/python3.7/site-packages/joblib/parallel.py in retrieve(self)
    931             try:
    932                 if getattr(self._backend, 'supports_timeout', False):
--> 933                     self._output.extend(job.get(timeout=self.timeout))
    934                 else:
    935                     self._output.extend(job.get())

/opt/conda/lib/python3.7/site-packages/joblib/_parallel_backends.py in wrap_future_result(future, timeout)
    540         AsyncResults.get from multiprocessing."""
    541         try:
--> 542             return future.result(timeout=timeout)
    543         except CfTimeoutError as e:
    544             raise TimeoutError from e

/opt/conda/lib/python3.7/concurrent/futures/_base.py in result(self, timeout)
    433                 raise CancelledError()
    434             elif self._state == FINISHED:
--> 435                 return self.__get_result()
    436             else:
    437                 raise TimeoutError()

/opt/conda/lib/python3.7/concurrent/futures/_base.py in __get_result(self)
    382     def __get_result(self):
    383         if self._exception:
--> 384             raise self._exception
    385         else:
    386             return self._result

error: 'i' format requires -2147483648 <= number <= 2147483647
```

Is this a bug or is it something to do with the way I'm formatting my data?


I tried to transform this into a sparse matrix as well as just leaving it as dataframes. I though that RandomForest was off the shelf but it seems I might need to preprocess my data more. I transformed the categorical variables into frequency values.

There are around 170,000 rows in the data and 11 features.

### Steps/Code to Reproduce

```python
from sklearn.ensemble import RandomForestClassifier
from sklearn.multioutput import MultiOutputClassifier
from sklearn.model_selection import train_test_split

from sklearn import preprocessing
from sklearn import utils

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.4, random_state=4)

clf = RandomForestClassifier(random_state=1)
mtf = MultiOutputClassifier(clf, n_jobs=-1)
mtf.fit(X_train, y_train)
y_pred = mtf.predict(X_test)
```

### Expected Results

I expect the results shown in the example in sectio 1.12.3 in [https://scikit-learn.org/stable/modules/multiclass.html#multiclass](https://scikit-learn.org/stable/modules/multiclass.html#multiclass)

### Actual Results

```pytb
---------------------------------------------------------------------------
_RemoteTraceback                          Traceback (most recent call last)
_RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/joblib/externals/loky/process_executor.py", line 357, in _sendback_result
    exception=exception))
  File "/opt/conda/lib/python3.7/site-packages/joblib/externals/loky/backend/queues.py", line 247, in put
    self._writer.send_bytes(obj)
  File "/opt/conda/lib/python3.7/multiprocessing/connection.py", line 200, in send_bytes
    self._send_bytes(m[offset:offset + size])
  File "/opt/conda/lib/python3.7/multiprocessing/connection.py", line 393, in _send_bytes
    header = struct.pack("!i", n)
struct.error: 'i' format requires -2147483648 <= number <= 2147483647
"""

The above exception was the direct cause of the following exception:

error                                     Traceback (most recent call last)
/tmp/ipykernel_27/3726235399.py in <module>
     26 # Training the model on the training dataset
     27 # fit function is used to train the model using the training sets as parameters
---> 28 mtf.fit(X_train, y_train)
     29 # performing predictions on the test dataset
     30 y_pred = mtf.predict(X_test)

/opt/conda/lib/python3.7/site-packages/sklearn/multioutput.py in fit(self, X, Y, sample_weight, **fit_params)
    432             Returns a fitted instance.
    433         """
--> 434         super().fit(X, Y, sample_weight, **fit_params)
    435         self.classes_ = [estimator.classes_ for estimator in self.estimators_]
    436         return self

/opt/conda/lib/python3.7/site-packages/sklearn/multioutput.py in fit(self, X, y, sample_weight, **fit_params)
    204                 self.estimator, X, y[:, i], sample_weight, **fit_params_validated
    205             )
--> 206             for i in range(y.shape[1])
    207         )
    208 

/opt/conda/lib/python3.7/site-packages/joblib/parallel.py in __call__(self, iterable)
   1052 
   1053             with self._backend.retrieval_context():
-> 1054                 self.retrieve()
   1055             # Make sure that we get a last message telling us we are done
   1056             elapsed_time = time.time() - self._start_time

/opt/conda/lib/python3.7/site-packages/joblib/parallel.py in retrieve(self)
    931             try:
    932                 if getattr(self._backend, 'supports_timeout', False):
--> 933                     self._output.extend(job.get(timeout=self.timeout))
    934                 else:
    935                     self._output.extend(job.get())

/opt/conda/lib/python3.7/site-packages/joblib/_parallel_backends.py in wrap_future_result(future, timeout)
    540         AsyncResults.get from multiprocessing."""
    541         try:
--> 542             return future.result(timeout=timeout)
    543         except CfTimeoutError as e:
    544             raise TimeoutError from e

/opt/conda/lib/python3.7/concurrent/futures/_base.py in result(self, timeout)
    433                 raise CancelledError()
    434             elif self._state == FINISHED:
--> 435                 return self.__get_result()
    436             else:
    437                 raise TimeoutError()

/opt/conda/lib/python3.7/concurrent/futures/_base.py in __get_result(self)
    382     def __get_result(self):
    383         if self._exception:
--> 384             raise self._exception
    385         else:
    386             return self._result

error: 'i' format requires -2147483648 <= number <= 2147483647
```

### Versions

```shell
System:
    python: 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 06:08:53)  [GCC 9.4.0]
executable: /opt/conda/bin/python
   machine: Linux-5.15.65+-x86_64-with-debian-bullseye-sid

Python dependencies:
          pip: 22.1.2
   setuptools: 59.8.0
      sklearn: 1.0.2
        numpy: 1.21.6
        scipy: 1.7.3
       Cython: 0.29.32
       pandas: 1.3.5
   matplotlib: 3.5.3
       joblib: 1.0.1
threadpoolctl: 3.1.0
```

COMMENT:
Closing as no reproducible provided.

Labels: Bug, Needs Reproducible Code