|
| | TruncatedFourierFeatureMap (int num_frequencies, const Matrix &prob_per_dim, const Matrix &omega_per_dim, ConstVectorRef sigma_l, Scalar sigma_f, const RectSet &X_bounds) |
| | Construct a truncated Fourier feature map.
|
| | TruncatedFourierFeatureMap (int num_frequencies, const Matrix &prob_per_dim, const Matrix &omega_per_dim, double sigma_l, Scalar sigma_f, const RectSet &X_bounds) |
| | Construct a truncated Fourier feature map.
|
| Vector | map_vector (ConstVectorRef x) const |
| | Given a \( \texttip{d}{Dimension of the vector space} \) dimensional vector \( \texttip{x}{Element of the vector space} \), project it to the unit hypercube \( [0, 1]^d \), then compute the feature map.
|
| Vector | invert_vector (ConstVectorRef y) const |
| | Given a @2M+1 dimensional vector \( \texttip{y}{Element of the vector space} \), invert the feature map to obtain the original input vector.
|
| Matrix | map_matrix (ConstMatrixRef x) const |
| | Given an \( \texttip{n}{Number of samples} \times \texttip{d}{Dimension of the vector space} \) dimensional matrix \( \texttip{x}{Element of the vector space} \), project each row vector to the unit hypercube \( [0, 1]^d \), then compute the feature map.
|
| Dimension | dimension () const |
| | Get read-only access to the dimension of the the feature map space.
|
| const Matrix & | omega () const |
| | Get read-only access to the frequency matrix of the truncated Fourier feature map.
|
| const Vector & | weights () const |
| | Get read-only access to the weights matrix of the truncated Fourier feature map.
|
| int | num_frequencies () const |
| | Get read-only access to the number of frequencies per dimension of the truncated Fourier feature map.
|
| Scalar | captured_probability () const |
| | Get read-only access to the probability captured by the Fourier expansion of the truncated Fourier feature map.
|
| const RectSet & | X_bounds () const |
| | Get read-only access to the limits of the original input space.
|
| double | sigma_f () const |
| | Get read-only access to the sigma_f value of the truncated Fourier feature map.
|
| const Vector & | sigma_l () const |
| | Get read-only access to the sigma_l value of the truncated Fourier feature map.
|
| virtual RectSet | get_periodic_set () const |
| | Return the periodic input domain for this linear truncated Fourier map.
|
| std::unique_ptr< FeatureMap > | clone () const override |
| | Clone the feature map.
|
| Matrix | operator() (ConstMatrixRef x) const |
| | Apply the feature map to a vector.
|
| Matrix | invert (ConstMatrixRef y) const |
| | Apply the inverse feature map to a vector.
|
| virtual std::string | to_string () const |
| | Obtain the string representation of this object.
|
Truncated Fourier feature map.
It maps vectors from \( \texttip{\mathcal{X}}{Polish sample vector space} \subseteq \mathbb{R}^d \) to a higher-dimensional space using the truncated Fourier series. The number of frequencies, \( M > 0 \), determines the dimension of the output space. All possible combinations of frequencies are computed for each input dimension. Therefore, the output vector has a dimension of \( 2^d M + 1 \). The feature map is computed as
\[\phi_{M}(x) = \sigma_{f}\begin{bmatrix}
w_{0}\\
\sqrt{2}w_{1}\cos(\omega_{1}^{\top}P(x))\\
\sqrt{2}w_{1}\sin(\omega_{1}^{\top}P(x))\\
\vdots\\
\sqrt{2}w_{M}\cos(\omega_{M}^{\top}P(x))\\
\sqrt{2}w_{M}\sin(\omega_{M}^{\top}P(x))
\end{bmatrix},
\]
The way the weights and omegas are computed depends on the subclass.
| RectSet lucid::TruncatedFourierFeatureMap::get_periodic_set |
( |
| ) |
const |
|
nodiscardvirtual |
Return the periodic input domain for this linear truncated Fourier map.
We want to find a space such that the smallest frequency is able to complete a full period. Given that frequencies are defined as \( \omega P(x) \), where \( P(x) \) is the projection to the unit hypercube of the original domain, we want to find the upper bound of the periodic domain \( \bar{x} \) such that
\[\omega P(\bar{x}) = 2\pi
\]
for the smallest \( \omega \). Graphically,
New max (x̄)
┌───────────────────────────────●
│ │
│ │
│ Old max │
├───────────────────────● │
│ │ │
│ │ │
│ │ │
│ │ │
│ Min │ │
●───────────────────────┴───────┘
Notice how the lower bound remains fixed, while the upper bound is shifted to create the periodic domain.
- Note
- The periodic domain could be smaller than the original domain, depending on the values of \( \sigma_l \).
- Precondition
- \( \sigma_l \) must have the same dimension as the input space.
-
All values in \( \sigma_l \) must be greater than 0.
- Returns
- new RectSet representing the periodic input domain
Reimplemented in lucid::ConstantTruncatedFourierFeatureMap, and lucid::LinearTruncatedFourierFeatureMap.