Skip to content

beta_wavelet_expansion

Bases: discrete_wavelet_expansion

Beta Wavelet Expansion.

Applies the Beta wavelet function for feature expansion.

Notes

Formally, given the input variable \(\mathbf{x} \in R^{m}\), to approximate the underlying mapping \(f: R^m \to R^n\) with wavelet analysis, we can define the approximated output as

\[
    \begin{equation}
    f(\mathbf{x}) \approx \sum_{s, t} \left \langle f(\mathbf{x}), \phi_{s, t} (\mathbf{x} | a, b) \right \rangle \cdot \phi_{s, t} (\mathbf{x} | a, b),
    \end{equation}
\]

where \(\phi_{s, t} (\cdot | a, b)\) denotes the child wavelet defined by hyper-parameters \(a > 1\) and \(b > 0\):

\[
    \begin{equation}
    \phi_{s, t}(x | a, b) = \frac{1}{\sqrt{a^s}} \phi \left( \frac{x - t \cdot b \cdot a^s}{a^s} \right).
    \end{equation}
\]

Based on the wavelet mapping \(\phi_{s, t} (\cdot | a, b)\), we can introduce the \(1_{st}\)-order and \(2_{nd}\)-order wavelet data expansion functions as follows:

\[
    \begin{equation}
    \kappa(\mathbf{x} | d=1) = \left[ \phi_{0, 0}(\mathbf{x}), \phi_{0, 1}(\mathbf{x}), \cdots, \phi_{s, t}(\mathbf{x}) \right] \in R^{D_1}.
    \end{equation}
\]

and

\[
    \begin{equation}
    \kappa(\mathbf{x} | d=2) = \kappa(\mathbf{x} | d=1) \otimes \kappa(\mathbf{x} | d=1) \in R^{D_2}.
    \end{equation}
\]

The output dimensions of the order-1 and order-2 wavelet expansions are \(D_1 = s \cdot t \cdot m\) and \(D_2 = (s \cdot t \cdot m)^2\), respectively.

Specifically, the functions \(\left\{ \phi_{s, t}\right\}_{ s, t \in Z}\) defines the orthonormal basis of the space and the mapping \(\phi(\cdot)\) used in the child wavelet may have different representations.

For Beta wavelet, it can be represented as follows:

Beta Wavelet:

$$ \begin{equation} \begin{aligned} &\phi(\tau | \alpha, \beta) = \frac{1}{B(\alpha, \beta)} \tau^{\alpha - 1} (1-\tau)^{\beta -1}, \end{aligned} \end{equation} $$ where \(\alpha, \beta \in [1, \infty]\).

Attributes:

Name Type Description
wavelet callable

Beta wavelet function used during the transformation.

Methods:

Name Description
Inherits all methods from `discrete_wavelet_expansion`.
Source code in tinybig/expansion/wavelet_expansion.py
class beta_wavelet_expansion(discrete_wavelet_expansion):
    r"""
        Beta Wavelet Expansion.

        Applies the Beta wavelet function for feature expansion.

        Notes
        ----------
        Formally, given the input variable $\mathbf{x} \in R^{m}$, to approximate the underlying mapping $f: R^m \to R^n$ with wavelet analysis, we can define the approximated output as

        $$
            \begin{equation}
            f(\mathbf{x}) \approx \sum_{s, t} \left \langle f(\mathbf{x}), \phi_{s, t} (\mathbf{x} | a, b) \right \rangle \cdot \phi_{s, t} (\mathbf{x} | a, b),
            \end{equation}
        $$

        where $\phi_{s, t} (\cdot | a, b)$ denotes the child wavelet defined by hyper-parameters $a > 1$ and $b > 0$:

        $$
            \begin{equation}
            \phi_{s, t}(x | a, b) = \frac{1}{\sqrt{a^s}} \phi \left( \frac{x - t \cdot b \cdot a^s}{a^s} \right).
            \end{equation}
        $$

        Based on the wavelet mapping $\phi_{s, t} (\cdot | a, b)$, we can introduce the $1_{st}$-order and $2_{nd}$-order wavelet data expansion functions as follows:

        $$
            \begin{equation}
            \kappa(\mathbf{x} | d=1) = \left[ \phi_{0, 0}(\mathbf{x}), \phi_{0, 1}(\mathbf{x}), \cdots, \phi_{s, t}(\mathbf{x}) \right] \in R^{D_1}.
            \end{equation}
        $$

        and

        $$
            \begin{equation}
            \kappa(\mathbf{x} | d=2) = \kappa(\mathbf{x} | d=1) \otimes \kappa(\mathbf{x} | d=1) \in R^{D_2}.
            \end{equation}
        $$

        The output dimensions of the order-1 and order-2 wavelet expansions are $D_1 = s \cdot t \cdot m$ and $D_2 = (s \cdot t \cdot m)^2$, respectively.

        Specifically, the functions $\left\{ \phi_{s, t}\right\}_{ s, t \in Z}$ defines the orthonormal basis of the space and
        the mapping $\phi(\cdot)$ used in the child wavelet may have different representations.

        For Beta wavelet, it can be represented as follows:

        __Beta Wavelet:__

        $$
            \begin{equation}
            \begin{aligned}
            &\phi(\tau | \alpha, \beta) = \frac{1}{B(\alpha, \beta)} \tau^{\alpha - 1} (1-\tau)^{\beta -1},
            \end{aligned}
            \end{equation}
        $$
        where $\alpha, \beta \in [1, \infty]$.

        Attributes
        ----------
        wavelet : callable
            Beta wavelet function used during the transformation.

        Methods
        -------
        Inherits all methods from `discrete_wavelet_expansion`.
    """
    def __init__(self, name: str = 'beta_wavelet_expansion', a: float = 1.0, b: float = 1.0, alpha: float = 1.0, beta: float = 1.0,  *args, **kwargs):
        """
            Initializes the Beta wavelet expansion.

            Parameters
            ----------
            name : str, optional
                Name of the transformation. Defaults to 'beta_wavelet_expansion'.
            a : float, optional
                The scaling factor for the wavelet. Defaults to 1.0.
            b : float, optional
                The translation factor for the wavelet. Defaults to 1.0.
            alpha : float, optional
                Alpha parameter for the Beta wavelet. Defaults to 1.0.
            beta : float, optional
                Beta parameter for the Beta wavelet. Defaults to 1.0.
            *args : tuple
                Additional positional arguments.
            **kwargs : dict
                Additional keyword arguments.
        """
        super().__init__(name=name, *args, **kwargs)
        self.wavelet = beta_wavelet(a=a, b=b, alpha=alpha, beta=beta)

__init__(name='beta_wavelet_expansion', a=1.0, b=1.0, alpha=1.0, beta=1.0, *args, **kwargs)

Initializes the Beta wavelet expansion.

Parameters:

Name Type Description Default
name str

Name of the transformation. Defaults to 'beta_wavelet_expansion'.

'beta_wavelet_expansion'
a float

The scaling factor for the wavelet. Defaults to 1.0.

1.0
b float

The translation factor for the wavelet. Defaults to 1.0.

1.0
alpha float

Alpha parameter for the Beta wavelet. Defaults to 1.0.

1.0
beta float

Beta parameter for the Beta wavelet. Defaults to 1.0.

1.0
*args tuple

Additional positional arguments.

()
**kwargs dict

Additional keyword arguments.

{}
Source code in tinybig/expansion/wavelet_expansion.py
def __init__(self, name: str = 'beta_wavelet_expansion', a: float = 1.0, b: float = 1.0, alpha: float = 1.0, beta: float = 1.0,  *args, **kwargs):
    """
        Initializes the Beta wavelet expansion.

        Parameters
        ----------
        name : str, optional
            Name of the transformation. Defaults to 'beta_wavelet_expansion'.
        a : float, optional
            The scaling factor for the wavelet. Defaults to 1.0.
        b : float, optional
            The translation factor for the wavelet. Defaults to 1.0.
        alpha : float, optional
            Alpha parameter for the Beta wavelet. Defaults to 1.0.
        beta : float, optional
            Beta parameter for the Beta wavelet. Defaults to 1.0.
        *args : tuple
            Additional positional arguments.
        **kwargs : dict
            Additional keyword arguments.
    """
    super().__init__(name=name, *args, **kwargs)
    self.wavelet = beta_wavelet(a=a, b=b, alpha=alpha, beta=beta)