[ML] Fourier Feature Encoding

ball·2024년 5월 31일

[ML] Transformer

목록 보기
1/2

You are trying to make a model that use numerical value as data. We can directly use the data value because it is already numerical, but we don't.
We should do some preprocessing such as normalization.

How should we preprocess the data? Divide it by average? Fourier Feature Encoding is a powerful way to preprocess datas.

Fourier Transformation

Any periodic function can be approximated into sum of sinsin, coscos functions. We call those sum as Fourier Series.

Fourier Feature Encoding

Let's say we have a scalar data xx. In Fourier Feature encoding, we change this scalar value xx into higher dimensional data.

x(sin(x)sin(2x)cos(x)cos(2x),sin(x)2,cos(x)2,sin(x)22,cos(x)22,x \mapsto (sin(x)sin(2x)cos(x)cos(2x), \frac{sin(x)}{2}, \frac{cos(x)}{2}, \frac{sin(x)}{2^2}, \frac{cos(x)}{2^2},
...,sin(x)2n,cos(x)2n)..., \frac{sin(x)}{2^n}, \frac{cos(x)}{2^n})

Why we use Fourier Feature Encoding

By Fourier Feature Encoding, we can split numerical values into sum of sinsin, coscos function with variant frequencyfrequency.

Then we can easily capture the change in numerical values. The following red dots are two data of blood pressure. For low frequency sine wave, the difference is small. But in high frequency sine wave, the difference is huge.

Fouriere Feature Encoding will enrich the numerical value, and make a rich gradient. This encoding will make the backpropagation efficient!

References

[1] https://sair.synerise.com/fourier-feature-encoding/

profile
KAIST CS Major

0개의 댓글