Add sample_weight parameter to OneHotEncoder.fit(...)

### Describe the workflow you want to enable

I have a dataset with huge number of duplicates - so in order to speed-up learning process I prefer to remove these duplicates and pass `sample_weight=duplicate_counts` to the `fit(..)` method of estimator. I override the `fit(..)` method of estimator and remove duplicates in this wrapper.

But If I use `OneHotEncoder` as pre-processing step, it produces sparse output - so the input to `estimator.fit(..)` is sparse. My dataset is large, so I strongly want to use sparse output of `OneHotEncoder`.

And effective duplicate removal in sparse input is not a trivial task - it must use sorting or hashing.  So I want to perform duplicate removal and `sample_weight` calculation before one hot encoding.

But I use the `min_frequency` parameter of `OneHotEncoder` - and want level frequencies to be calculated with the use of `sample_weight`. 

### Describe your proposed solution

Add `sample_weight` parameter to `OneHotEncoder.fit(..)` function and calculate level frequencies using `sample_weight` parameter.

### Describe alternatives you've considered, if relevant

_No response_

### Additional context

_No response_

COMMENT:
From a brief glance at the code, I can see that OHE uses `np.unique` with `return_counts=True` to count the rows for each category and perform the cutoff. I've created a function (with ChatGPT's help :P) that does the same as `np.unique`, but with the addition of sample weight (instead of count, it sums the `sample_weight` accordingly). I was thinking of using it when one passes `sample_weight` and keeping everything else the same (including the `min_frequency` with only an updated docstring). At a high level, does this approach make sense to you, @betatim?

I might have time to work on this in the next few days, and I hope to submit a PR later this week. :)

```python
def groupby_sum(arr, sample_weight, return_index=False, return_inverse=False, return_counts=False, axis=None, equal_nan=False):
    if axis is not None:
        raise NotImplementedError("This function does not support the 'axis' parameter.")
    
    # Sort the input array and the sample_weight array based on the input array values
    sorted_indices = np.argsort(arr)
    sorted_arr = arr[sorted_indices]
    sorted_sample_weight = sample_weight[sorted_indices]

    # Find the unique elements in the sorted input array and their index positions
    unique_elements, unique_indices, unique_inverse, unique_counts = np.unique(sorted_arr, return_index=True, return_inverse=True, return_counts=True)

    # Add the length of the array to the unique_indices to handle the last group
    unique_indices = np.append(unique_indices, len(arr))

    # Split the sorted sample_weight array into subarrays using the unique_indices
    subarrays = np.split(sorted_sample_weight, unique_indices[1:])

    # Sum each subarray to get the groupby sum
    group_sums = np.array([np.sum(subarray.astype(float)) for subarray in subarrays[: -1]])

    results = [unique_elements]
    if return_index:
        results.append(unique_indices[:-1])
    if return_inverse:
        results.append(unique_inverse)
    if return_counts:
        results.append(group_sums)
    return tuple(results)
```

Labels: New Feature