htfa.tfa.component_factors

htfa.tfa.component_factors(R, centers, widths, mixing_weights, kernel='rbf')[source]

Factors of a fit with any kernel and number of components.

Factor k is sum_m pi_km phi(||r - c_km||**2 / w_km) with the profile phi of kernel (see TFA).

Parameters:
Rndarray, shape (V, D)

Coordinates to evaluate the factors at.

centersarray_like, shape (K, M, D)

Component centers (component_centers_ of a fit).

widthsarray_like, shape (K, M)

Component widths (component_widths_).

mixing_weightsarray_like, shape (K, M)

Positive mixing weights summing to 1 per factor (mixing_weights_).

kernel{‘rbf’, ‘laplace’, ‘mexican_hat’}, default=’rbf’

Profile of the components.

Returns:
ndarray, shape (V, K)

Examples

>>> import numpy as np
>>> from htfa.tfa import component_factors
>>> R = np.array([[0.0, 0.0], [1.0, 0.0], [3.0, 0.0]])
>>> F = component_factors(R, [[[0.0, 0.0], [3.0, 0.0]]], [[1.0, 1.0]],
...                       [[0.75, 0.25]])
>>> np.round(F[:, 0], 3)
array([0.75, 0.28, 0.25])