skdownscale.pointwise_models.GroupedRegressor

class skdownscale.pointwise_models.GroupedRegressor(estimator, fit_grouper, predict_grouper, estimator_kwargs=None, fit_grouper_kwargs=None, predict_grouper_kwargs=None)[source]

Bases: object

Grouped Regressor

Wrapper supporting fitting seperate estimators distinct groups

Parameters:
  • estimator (object) – Estimator object such as derived from BaseEstimator. This estimator will be fit to each group

  • fit_grouper (object) – Grouper object, such as pd.Grouper or PaddedDOYGrouper used to split data into groups during fitting.

  • predict_grouper (object, func, str) – Grouper object, such as pd.Grouper used to split data into groups during prediction.

  • estimator_kwargs (dict) – Keyword arguments to pass onto the estimator’s contructor.

  • fit_grouper_kwargs (dict) – Keyword arguments to pass onto the `fit_grouper`s contructor.

  • predict_grouper_kwargs (dict) – Keyword arguments to pass onto the `predict_grouper`s contructor.

__init__(estimator, fit_grouper, predict_grouper, estimator_kwargs=None, fit_grouper_kwargs=None, predict_grouper_kwargs=None)[source]

Methods

__init__(estimator, fit_grouper, predict_grouper)

fit(X, y, **fit_kwargs)

Fit the grouped regressor

predict(X)

Predict estimator target for X

fit(X, y, **fit_kwargs)[source]

Fit the grouped regressor

Parameters:
  • X (pd.DataFrame, shape (n_samples, n_features)) – Training data

  • y (pd.Series or pd.DataFrame, shape (n_samples, ) or (n_samples, n_targets)) – Target values

  • **fit_kwargs – Additional keyword arguments to pass onto the estimator’s fit method

Returns:

self (returns an instance of self.)

predict(X)[source]

Predict estimator target for X

Parameters:

X (pd.DataFrame, shape (n_samples, n_features)) – Training data

Returns:

y (ndarray of shape (n_samples,) or (n_samples, n_outputs)) – The predicted values.