neuraltrain.models.common.FourierEmb

class neuraltrain.models.common.FourierEmb(*, n_freqs: int | None = 12, total_dim: int | None = None, n_dims: int = 2, margin: float = 0.2)[source][source]

Configuration for Fourier positional embedding.

Parameters:
  • n_freqs (int | None) – Number of frequencies (harmonics) used to encode one dimension.

  • total_dim (int | None) –

    If provided instead of n_freqs, this will be used to compute the number of frequencies following this relationship:

    n_freqs = (total_dim / 2) ** (1 / n_dims)

    If the resulting n_freqs is not an integer an exception will be raised.

  • n_dims (int) – Number of dimensions to embed. This should be 2 for 2D positions (e.g. MNE layouts) or 3 for 3D positions (e.g. MNE montages).

  • margin (float) – How much to extend the range of the embedding to avoid edge effects.