EMMixedEffectsConverter#
- class skfda.representation.conversion.EMMixedEffectsConverter(basis)[source]#
Mixed effects to-basis-converter using the EM algorithm.
Minimizes the profile loglikelihood of the mixed effects model with the EM algorithm as proposed by Nan Laird and Stram[1].
Methods
fit(X[, y, initial_params, maxiter, ...])Fit the model using the EM algorithm.
fit_transform(X[, y])Fit to data, then transform it.
set_output(*[, transform])Set output container.
transform(X)Transform X to FDataBasis using the fitted converter.
- Parameters:
basis (Basis)
- fit(X, y=None, *, initial_params=None, maxiter=700, convergence_criterion=None, rtol=0.001)[source]#
Fit the model using the EM algorithm.
- Parameters:
X (FDataIrregular) – irregular data to fit.
y (object) – ignored.
initial_params (Params | ndarray[tuple[int, ...], dtype[floating[Any]]] | None) – initial params of the model.
maxiter (int) – maximum number of iterations.
convergence_criterion (Literal['params', 'squared-error', 'loglikelihood'] | None) –
convergence criterion to use when fitting.
- ”params”:
to use relative differences between parameters (the default).
- ”squared-error”:
to use relative changes in the squared error of the estimated values with respect to the original data.
- ”loglikelihood”:
to use relative changes in the loglikelihood.
rtol (float) – relative tolerance for convergence.
- Returns:
The converter after fitting.
- Return type:
- 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.
- Returns:
X_new – Transformed array.
- Return type:
ndarray array of shape (n_samples, n_features_new)
- set_output(*, transform=None)#
Set output container.
See 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
- transform(X)[source]#
Transform X to FDataBasis using the fitted converter.
- Parameters:
X (FDataIrregular)
- Return type:
Examples using skfda.representation.conversion.EMMixedEffectsConverter#
Mixed effects model for irregular data: robustness of the conversion