folie.functions.KernelFunction

class folie.functions.KernelFunction(gamma, domain, kernel='rbf', output_shape=())[source]
copy()[source]

Makes a deep copy of this function.

Returns:
copy

A new copy of this model.

fit(x, y=None, gamma_range=None, **kwargs)[source]

Set reference frame associated with function values

Parameters:
Xarray-like of shape (n_references, n_features)

List of n_features-dimensional data points. Each row corresponds to a single data point.

yarray-like of shape (n_references, )

The target values of the function to interpolate.

gamma_range: iterable

List of gamma values to try for optimization

Returns:
selfobject

Returns 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:
Xarray-like of shape (n_samples, n_features)

Input samples.

yarray-like of shape (n_samples,) or (n_samples, n_outputs), default=None

Target values (None for unsupervised transformations).

**fit_paramsdict

Additional fit parameters.

Returns:
X_newndarray array of shape (n_samples, n_features_new)

Transformed array.

get_params(deep=False)[source]

Get the parameters.

Returns:
paramsmapping of string to any

Parameter names mapped to their values.

grad_coeffs(x, *args, **kwargs)[source]

Gradient of the function with respect to the coefficients.

Parameters:
xarray_like

Input data.

Returns:
transformedarray_like

The gradient

resize(new_shape)[source]

Change the output shape of the function.

Parameters:
new_shapetuple, array-like

The new output shape of the function

set_output(*, transform=None)[source]

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:
selfestimator instance

Estimator instance.

set_params(**params)[source]

Set the parameters of this estimator.

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

Parameters:
**paramsdict

Estimator parameters.

Returns:
selfobject

Estimator instance.

transform(X, *args, **kwargs)[source]

A reference implementation of a predicting function.

Parameters:
X{array-like, sparse matrix}, shape (n_samples, n_features)

The samples.

Returns:
sndarray, shape (n_samples,)

Value of path variable along the path.

zndarray, shape (n_samples,)

Value of the distance to the path.

transform_d2x(x, *args, **kwargs)[source]

Hessian of the function with respect to input data. Implemented by finite difference.

transform_dx(x, **kwargs)[source]

Gradient of the function with respect to input data. Implemented by finite difference.

property coefficients

Access the coefficients