Skip to content

[BUG] RandomizedSearchCV documentation includes backend parameter but not in the constructor. #1013

@MaazAli8460

Description

@MaazAli8460

Describe the bug
In skpro\model_selection\ _tuning.py
RandomizedSearchCV documentation says there is a backend parameter, but the constructor currently does not accept backend.

To Reproduce

import pandas as pd
from sklearn.model_selection import KFold

from skpro.model_selection import RandomizedSearchCV
from skpro.regression.dummy import DummyProbaRegressor

# Minimal data
X = pd.DataFrame({"x": [1, 2, 3, 4]})
y = pd.DataFrame({"y": [1.0, 2.0, 3.0, 4.0]})

# Reproducer for issue:
# TypeError: RandomizedSearchCV.__init__() got an unexpected keyword argument 'backend'
rscv = RandomizedSearchCV(
    estimator=DummyProbaRegressor(),
    cv=KFold(n_splits=2),
    param_distributions={"strategy": ["empirical"]},
    n_iter=1,
    backend="loky",
)

print(rscv)

Actual behavior

Traceback (most recent call last):
  File "D:\D drive\skpro\x.py", line 13, in <module>
    rscv = RandomizedSearchCV(
        estimator=DummyProbaRegressor(),
    ...<3 lines>...
        backend="loky",
    )
TypeError: RandomizedSearchCV.__init__() got an unexpected keyword argument 'backend'

Expected behavior

RandomizedSearchCV should accept backend and pass it through to BaseGridSearch (same behavior as GridSearchCV), or
The docs should remove backend from RandomizedSearchCV parameter if unsupported by design.

Environment

Python version: 3.14.0
skpro version: 2.12.0
skbase version: 0.13.1
scikit-learn version: 1.7.2
pandas version: 3.0.1
numpy version: 2.4.4
scipy version: 1.17.1

Additional context

The backend parameter already exists in the shared base constructor.

class BaseGridSearch(_DelegatedProbaRegressor):
    _tags = {
        "estimator_type": "regressor",
        "capability:multioutput": True,
        "capability:missing": True,
    }

    def __init__(
        self,
        estimator,
        cv,
        backend="loky",
        refit=True,
        scoring=None,
        verbose=0,
        return_n_best_estimators=1,
        error_score=np.nan,
        backend_params=None,
    ):

GridSearchCV does expose backend in its constructor.
Documentation currently lists backend under RandomizedSearchCV params.
Constructor for RandomizedSearchCV does not include backend.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions