skfolio.utils.tools.fit_single_estimator#
- skfolio.utils.tools.fit_single_estimator(estimator, X, y, fit_params, indices=None, axis=0, method='fit')[source]#
Fit (or partial-fit) an estimator on a subset of the data.
- Parameters:
- estimatorestimator object implementing ‘fit’ and ‘predict’
The object to use to fit the data.
- Xarray-like of shape (n_observations, n_assets)
The data to fit.
- yarray-like of shape (n_observations, n_targets), optional
The target array if provided.
- fit_paramsdict
Parameters that will be passed to the estimator method.
- indicesndarray, slice, or None, default=None
Rows or columns to select from X, y, and fit_params. The default (
None) is to select the entire data.- axisint, default=0
The axis along which
Xwill be sub-sampled.axis=0will select rows whileaxis=1will select columns.- methodstr, default=”fit”
Estimator method to call (e.g.
"fit"or"partial_fit").
- Returns:
- fitted_estimatorestimator
The fitted estimator.