flexcode.basis_functions
Functions for evaluation of orthogonal basis functions.
Module Contents
Classes
Functions
|
Evaluates a system of basis functions. |
|
Evaluates tensor basis. |
|
Evaluates cosine basis. |
|
Evaluates Fourier basis. |
|
Evaluates Daubechies basis. |
- evaluate_basis(responses, n_basis, basis_system)[source]
Evaluates a system of basis functions.
- Parameters:
responses (array) – An array of responses in [0, 1].
n_basis (integer) – The number of basis functions to calculate.
basis_system ({'cosine', 'Fourier', 'db4'}) – String denoting the system of orthogonal basis functions.
- Returns:
A matrix of basis functions evaluations. Each row corresponds to a value of responses, each column corresponds to a basis function.
- Return type:
numpy matrix
- Raises:
ValueError – If the basis system isn’t recognized.
- tensor_basis(responses, n_basis, basis_fn)[source]
Evaluates tensor basis.
Combines single-dimensional basis functions phi_{d}(z) to form orthogonal tensor basis $phi(z_{1}, dots, z_{D}) = prod_{d} phi_{d}(z_{d})$.
- Parameters:
responses (numpy matrix) – A matrix of responses in [0, 1]^(n_dim). Each column corresponds to a variable, each row corresponds to an observation.
n_basis (list of integers) – The number of basis function for each dimension. Should have the same length as the number of columns of responses.
basis_fn (function) – The function which evaluates the one-dimensional basis functions.
- Returns:
Returns a matrix where each column is a basis function and each row is an observation.
- Return type:
numpy matrix
- cosine_basis(responses, n_basis)[source]
Evaluates cosine basis.
- Parameters:
responses (array) – An array of responses in [0, 1].
n_basis (integer) – The number of basis functions to evaluate.
- Returns:
A matrix of cosine basis functions evaluated at responses. Each row corresponds to a value of responses, each column corresponds to a basis function.
- Return type:
numpy matrix
- fourier_basis(responses, n_basis)[source]
Evaluates Fourier basis.
- Parameters:
responses (array) – An array of responses in [0, 1].
n_basis (integer) – The number of basis functions to evaluate.
- Returns:
A matrix of Fourier basis functions evaluated at responses. Each row corresponds to a value of responses, each column corresponds to a basis function.
- Return type:
numpy matrix
- wavelet_basis(responses, n_basis, family='db4')[source]
Evaluates Daubechies basis.
- Parameters:
responses (array) – An array of responses in [0, 1].
n_basis (integer) – The number of basis functions to evaluate.
family (string) – The wavelet family to evaluate.
- Returns:
A matrix of Fourier basis functions evaluated at responses. Each row corresponds to a value of responses, each column corresponds to a basis function.
- Return type:
numpy matrix