Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support fit_params in stacking #18028

@a-wozniakowski

Description

@a-wozniakowski

Currently, there is no support for **fit_params in the fit method of _BaseStacking:

def fit(self, X, y, sample_weight=None):

As introduced in issue #15953 for _MultiOutputEstimator, it seems natural to extend the utility to stacking. A proposed implementation in the base stacking class is as follows:

from ..utils.validation import _check_fit_params

def fit(self, X, y, sample_weight=None, **fit_params):
    # Right before predictions = Parallel...
    if fit_params:
        fit_params = _check_fit_params(X, fit_params)
    else:
        fit_params = (dict(sample_weight=sample_weight)
                      if sample_weight is not None
                      else None)
    # Then, utilize fit_params in the parallelized cross_val_predict

Subsequently, alter the fit methods for StackingClassifier and StackingRegressor such that they support **fit_params. If this is favorable, then I can write an implementation and start the pull request.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions