Overflow in ParameterGrid.__len__

### Describe the bug

Dear all,

the __len__ function from the ParameterGrid gets an overflow when having a large HP parameter set.


### Steps/Code to Reproduce

```python
from sklearn.model_selection import ParameterGrid
import numpy as np


hyper_parameters = {
    'num_coupling_layers_a': {'max': 10, 'min': 5},
    'num_coupling_layers_b': {'max': 10, 'min': 5},
    'num_t_layers_a': {'max': 10, 'min': 2},
    'num_t_layers_b': {'max': 10, 'min': 2},
    'num_s_layers_a': {'max': 10, 'min': 2},
    'num_s_layers_b': {'max': 10, 'min': 2},
    'size_t_layers_a': {'max': 100, 'min': 5},
    'size_t_layers_b': {'max': 100, 'min': 5},
    'size_s_layers_a': {'max': 100, 'min': 5},
    'size_s_layers_b': {'max': 100, 'min': 5},
    'num_hidden_layers': {'max': 10, 'min': 2},
    'size_hidden_layers': {'max': 100, 'min': 5},
    'reg': {'values': [0, 0.01, 0.001]},
    'drop_out': {'max': 1.0, 'min': 0.0},
    'batch_size': {'max': 1024, 'min': 128},
    'gamma': {'max': 1.0, 'min': 0.0},
    'epoch': {'values': [1]},
    'verbose': {'values': [1]}
}

parameters = {}
for para in hyper_parameters:
    if "max" in hyper_parameters[para].keys():
        minV = hyper_parameters[para]["min"]
        maxV = hyper_parameters[para]["max"]
        if type(maxV) == int:
            parameters[para] = np.arange(minV, maxV, 1)
        elif type(maxV) == float:
            parameters[para] = np.arange(minV, maxV, 0.1)
        else:
            raise TypeError("Only integers or floats are allowed")
    elif "values" in hyper_parameters[para].keys():
        parameters[para] = hyper_parameters[para]["values"]
    else:
        raise Exception("Sorry, the hyper_parameter has no key max, min or values")

print(len(ParameterGrid(parameters)))
```

### Expected Results

Should not throw an error

### Actual Results

The problem is that the `sys.maxsize` is smaller than `sum(product(len(v) for v in p.values()) if p else 1 for p in self.param_grid)` in the example (see https://stackoverflow.com/questions/50367014/catching-overflowerror).

However, I think that one should not be limited by the build-in `len` function here, because the line which does fail `len(ParameterGrid(self.param_distributions))` is anyway only important if `self.n_iter > grid_size` which is never the case (hopefully :D).

One way to solve this is to "reset" to sys.maxsize
```python
num_sample = sum(
    product(len(v) for v in p.values()) if p else 1 for p in self.param_grid
)
if num_sample > sys.maxsize:
    num_sample = sys.maxsize
```

### Versions

```shell
System:
    python: 3.10.10 (main, Mar  5 2023, 22:26:53) [GCC 12.2.1 20230201]
executable: /home/makoeppel/ranking/combined_project/venv-kedro/bin/python
   machine: Linux-6.1.23-1-lts-x86_64-with-glibc2.37

Python dependencies:
      sklearn: 1.1.3
          pip: 23.0.1
   setuptools: 67.6.1
        numpy: 1.23.5
        scipy: 1.8.1
       Cython: None
       pandas: 1.5.2
   matplotlib: 3.6.2
       joblib: 1.2.0
threadpoolctl: 3.1.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
         prefix: libgomp
       filepath: /home/makoeppel/ranking/combined_project/venv-kedro/lib/python3.10/site-packages/scikit_learn.libs/libgomp-a34b3233.so.1.0.0
        version: None
    num_threads: 8

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /home/makoeppel/ranking/combined_project/venv-kedro/lib/python3.10/site-packages/numpy.libs/libopenblas64_p-r0-742d56dc.3.20.so
        version: 0.3.20
threading_layer: pthreads
   architecture: Sandybridge
    num_threads: 8

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /home/makoeppel/ranking/combined_project/venv-kedro/lib/python3.10/site-packages/scipy.libs/libopenblasp-r0-8b9e111f.3.17.so
        version: 0.3.17
threading_layer: pthreads
   architecture: Sandybridge
    num_threads: 8
```

COMMENT:
I was also thinking about this in the first place that the space is to large. But what if one searches with some guided search like Bayesian optimization? I had the issue when I setup a random search to get a feeling for the HPs.

Labels: Bug, Needs Triage