LinearSVC fails when used with Bagging

### Describe the bug

Using the Bagging class with LinearSVC as baseestimator throws 
```
TerminatedWorkerError: A worker process managed by the executor was unexpectedly terminated. This could be caused by a segmentation fault while calling the function or by an excessive memory usage causing the Operating System to kill the worker.
```

If I look at the Jupyter-outputs it throws multiple warnings like `WARNING: class label 79368 specified in weight is not found` until et eventually throw an "segmentation fault".

I'm running the code in VScode using the "interactive window" but this also fails just running the program in a terminal

I'm monitoring my RAM-usage and at no time has it accessed 46% thus I find it strange that it should be some kind of memory issue


### Steps/Code to Reproduce

If I use the Iris dataset it works fine, thus I'm having difficulties reproducing the issue with public data. Using our company data though it fails

```python
svm = LinearSVC(class_weight = "balanced")
bagging_model = BaggingClassifier(svm,n_jobs = -1,n_estimators = 1325)
bagging_model.fit(X_train,y_train)
```

where `X_train` is a `<1338899x37066 sparse matrix of type '<class 'numpy.float64'>'
	with 2328037 stored elements in Compressed Sparse Row format>`

Using the first 100, 1000 and 10.000 datapoints works fine i.e the model is fitted. But using the full dataset it crashes with the error described above. 

I've noticed that the same bug has been there before https://github.com/scikit-learn/scikit-learn/issues/9494, [SO](https://stackoverflow.com/questions/32090776/class-label-not-found-sklearn-error) thus it might be related to that.

### Expected Results

No error is thrown/no crash

### Actual Results

Python crashes with the stack-trace

```
TerminatedWorkerError                     Traceback (most recent call last)
c:\Code\dinero-web-2.0\Dinero.Ai\AutoBogfoering\Dev\dev_main.py in <cell line: 2>()
      71 bagging_model = BaggingClassifier(svm,n_jobs = -1,n_estimators = n_estimators)
----> 72 bagging_model.fit(X_train,y_train)

File c:\Users\Hennings\AppData\Local\Programs\Python\Python310\lib\site-packages\sklearn\ensemble\_bagging.py:297, in BaseBagging.fit(self, X, y, sample_weight)
    288 # Convert data (X is required to be 2d and indexable)
    289 X, y = self._validate_data(
    290     X,
    291     y,
   (...)
    295     multi_output=True,
    296 )
--> 297 return self._fit(X, y, self.max_samples, sample_weight=sample_weight)

File c:\Users\Hennings\AppData\Local\Programs\Python\Python310\lib\site-packages\sklearn\ensemble\_bagging.py:434, in BaseBagging._fit(self, X, y, max_samples, max_depth, sample_weight, check_input)
    431 seeds = random_state.randint(MAX_INT, size=n_more_estimators)
    432 self._seeds = seeds
--> 434 all_results = Parallel(
    435     n_jobs=n_jobs, verbose=self.verbose, **self._parallel_args()
    436 )(
    437     delayed(_parallel_build_estimators)(
    438         n_estimators[i],
    439         self,
...
    393         # Break a reference cycle with the exception in self._exception
    394         self = None

TerminatedWorkerError: A worker process managed by the executor was unexpectedly terminated. This could be caused by a segmentation fault while calling the function or by an excessive memory usage causing the Operating System to kill the worker.

```




I get a lot of rows stating `WARNING: class label <i> specified in weight is not found` until et eventually throw an "segmentation fault".

### Versions

```shell
System:
    python: 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.1929 64 bit (AMD64)]
executable: C:\MyPath\Programs\Python\Python310\python.exe
   machine: Windows-10-10.0.22621-SP0

Python dependencies:
      sklearn: 1.1.2
          pip: 22.2.2
   setuptools: 58.1.0
        numpy: 1.23.2
        scipy: 1.8.0
       Cython: 0.29.28
       pandas: 1.4.0
   matplotlib: 3.5.1
       joblib: 1.1.0
threadpoolctl: 3.1.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
         prefix: vcomp
       filepath: C:\Users\Hennings\AppData\Local\Programs\Python\Python310\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: C:\Users\Hennings\AppData\Local\Programs\Python\Python310\Lib\site-packages\numpy\.libs\libopenblas.FB5AE2TYXYH2IJRDKGDGQ3XBKLKTF43H.gfortran-win_amd64.dll
        version: 0.3.20
threading_layer: pthreads
   architecture: SkylakeX
    num_threads: 16

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: C:\Users\Hennings\AppData\Local\Programs\Python\Python310\Lib\site-packages\scipy\.libs\libopenblas.XWYDX2IKJW2NMTWSFYNGFUWKQU3LYTCZ.gfortran-win_amd64.dll
        version: 0.3.17
threading_layer: pthreads
   architecture: Prescott
    num_threads: 16
```

COMMENT:
> So the missing label is simply just due to too few samples of a given class, correct?

Correct

> RAM-usage grow towards 100% (it keeps below 50%), or
> An "OutOfMemoryError" which normally is thrown if you try convert sparse to dense?

It could be trigger by the out-of-memory killer in the C level that looks like segfault (https://pythonspeed.com/articles/python-out-of-memory/). It can be trigger at the moment of the `malloc` but the memory will never be allocated so you can potentially not observe it on the monitoring.

Is it crashing if you reduce `n_jobs`?

Labels: module:svm