MinimizeMixedEffectsConverter#

class skfda.representation.conversion.MinimizeMixedEffectsConverter(basis)[source]#

Mixed effects to-basis-converter using scipy.optimize.minimize.

Minimizes the profile loglikelihood of the mixed effects model as proposed by Lindstrom and Bates[1].

Methods

fit(X[, y, initial_params, ...])

Fit the model.

fit_transform(X[, y])

Fit to data, then transform it.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

set_fit_request(*[, has_mean, ...])

Configure whether metadata should be requested to be passed to the fit method.

set_output(*[, transform])

Set output container.

set_params(**params)

Set the parameters of this estimator.

transform(X)

Transform X to FDataBasis using the fitted converter.

Parameters:

basis (Basis)

fit(X, y=None, *, initial_params=None, minimization_method=None, has_mean=True)[source]#

Fit the model.

Parameters:
  • X (FDataIrregular) – irregular data to fit.

  • y (object) – ignored.

  • initial_params (Params | ndarray[tuple[Any, ...], dtype[floating[Any]]] | None) – initial params of the model.

  • minimization_method (str | None) – scipy.optimize.minimize method to be used for the minimization of the loglikelihood of the model.

  • has_mean (bool) – Whether the mean is a fixed parameter to be optimized or estimated with ML estimator from the covariance parameters.

Returns:

self after fit

Return type:

Self

fit_transform(X, y=None, **fit_params)[source]#

Fit to data, then transform it.

Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.

Parameters:
  • X (array-like of shape (n_samples, n_features)) – Input samples.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs), default=None) – Target values (None for unsupervised transformations).

  • **fit_params (dict) – Additional fit parameters. Pass only if the estimator accepts additional params in its fit method.

Returns:

X_new – Transformed array.

Return type:

ndarray array of shape (n_samples, n_features_new)

get_metadata_routing()#

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Returns:

routing – A MetadataRequest encapsulating routing information.

Return type:

MetadataRequest

get_params(deep=True)#

Get parameters for this estimator.

Parameters:

deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:

params – Parameter names mapped to their values.

Return type:

dict

set_fit_request(*, has_mean='$UNCHANGED$', initial_params='$UNCHANGED$', minimization_method='$UNCHANGED$')#

Configure whether metadata should be requested to be passed to the fit method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to fit if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to fit.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters:
  • has_mean (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for has_mean parameter in fit.

  • initial_params (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for initial_params parameter in fit.

  • minimization_method (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for minimization_method parameter in fit.

  • self (MinimizeMixedEffectsConverter)

Returns:

self – The updated object.

Return type:

object

set_output(*, transform=None)#

Set output container.

Refer to the user guide for more details and Introducing the set_output API for an example on how to use the API.

Parameters:

transform ({"default", "pandas", "polars"}, default=None) –

Configure output of transform and fit_transform.

  • ”default”: Default output format of a transformer

  • ”pandas”: DataFrame output

  • ”polars”: Polars output

  • None: Transform configuration is unchanged

Added in version 1.4: “polars” option was added.

Returns:

self – Estimator instance.

Return type:

estimator instance

set_params(**params)#

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Parameters:

**params (dict) – Estimator parameters.

Returns:

self – Estimator instance.

Return type:

estimator instance

transform(X)[source]#

Transform X to FDataBasis using the fitted converter.

Parameters:

X (FDataIrregular)

Return type:

FDataBasis