hofa.cdf#
This module contains the implementation of different alpha (weighting) functions to be used as weights for different eigenspaces depending on their eigenvalues.
Functions#
|
The cumulative distribution function that performs the denoising operator. |
|
Apply a cutoff operator to some eigenvalues, returning a boolean mask. |
|
Apply an average cutoff function to eigenvalues, scaling them by |
|
Give a mask that selects the top eigenvalues. |
|
The \(U^2\) dual operator. |
Module Contents#
- hofa.cdf.relu(eigvals: numpy.ndarray, epsilon: float)#
The cumulative distribution function that performs the denoising operator.
This function computes \(\max(1-\tfrac{\varepsilon}{\max(\sqrt{x},\varepsilon/2)},0)\) for each eigenvalue \(x\) in
eigvalswhereepsilonequals \(\varepsilon\).- Parameters:
eigvals (np.ndarray) – A 1-D array of eigenvalues to which the cumulative distribution function of the denoising operator with parameter
epsilonis applied.epsilon (float) – A small constant used to adjust the threshold behavior of the denoising operator.
- Returns:
An array of the same shape as
eigvals, with the weights that perform the same operation as the denoising operator with parameterepsilon.- Return type:
np.ndarray
- hofa.cdf.cutoff(eigvals: numpy.ndarray, epsilon: float)#
Apply a cutoff operator to some eigenvalues, returning a boolean mask.
This function returns
Truefor all eigenvalues that are greater than or equal to \(\varepsilon^2\), andFalseotherwise whereepsilon\(=\varepsilon\). In other words, it applies the map \(=1_{x\ge \varepsilon^2}\) for every \(x\) ineigvals.- Parameters:
eigvals (np.ndarray) – A 1-D array of eigenvalues to apply the cutoff function to.
epsilon (float) – A threshold value. Eigenvalues greater than or equal to \(\varepsilon^2\) are kept.
- Returns:
A boolean array of the same shape as
eigvals, whereTrueindicates that the eigenvalue passes the cutoff condition.- Return type:
np.ndarray
- hofa.cdf.avg_cutoff(eigvals: numpy.ndarray, epsilon: float)#
Apply an average cutoff function to eigenvalues, scaling them by
epsilon.This function computes \(\min \Big( \tfrac{ \sqrt{\max ( \varepsilon^2, x )}}{\varepsilon} - 1, 1 \Big)\) for each eigenvalue \(x\) in
eigvals.- Parameters:
eigvals (np.ndarray) – A 1-D array of eigenvalues to apply the average cutoff function to.
epsilon (float) – A scaling factor used in the cutoff function. Smaller values of
epsilonyield a stronger cutoff.
- Returns:
An array of the same shape as
eigvals, with the average cutoff transformation applied element-wise.- Return type:
np.ndarray
- hofa.cdf.top_eig(eigvals: numpy.ndarray, n: int)#
Give a mask that selects the top eigenvalues.
This function returns a 1-D vector with the same shape as
eigvals, consisting of all zeroes except in the positions of the largestnterms, which are ones.- Parameters:
eigvals (np.ndarray) – A 1-D array of eigenvalues to apply the mask function to.
n (int) – The number of eigenvalues to select.
- Returns:
An array of the same shape as
eigvals, containing zeros except at the firstnpositions, which are ones.- Return type:
np.ndarray
- hofa.cdf.u2_dual(eigvals: numpy.ndarray, unused: float)#
The \(U^2\) dual operator.
This function returns a copy of
eigvals.- Parameters:
eigvals (np.ndarray) – A 1-D array of eigenvalues.
unused (float) – Not used.
- Returns:
A copy of
eigvals.- Return type:
np.ndarray