o
odinpkg.dev
packages / library / RFF__Random_Fourier_Features_Ridge_Regressor

RFF__Random_Fourier_Features_Ridge_Regressor

f5fa005library

Example with approximating sinc( x ) function.

No license · updated 8 months ago

RFF - Random Fourier Features Ridge Regressor

Example with approximating sinc( x ) function.

Description

This is a implementation of a small lib for RFF - Random Fourier Features Ridge Regressor, with an example of the aproximation of a sinc( x ) function.

Target :
sinc( x ) = sin( x ) / x, with sinc( 0 ) = 1 .
Approximate sinc( x ) on [ -10, 10 ] .

Universal-approximation-like via RBF-ish kernel using random Fourier features, trained with one linear solve.

Output


Random Fourier Features Ridge Regressor ( approximating sinc( x ) function )

Target : sinc( x ) = sin( x ) / x, with sinc( 0 ) = 1 
Approximate sinc( x ) on [ -10, 10 ].
Universal-approximation-like via RBF-ish kernel using random 
Fourier features, trained with one linear solve.

Training RFF regressor on sinc...
Done.
x = -10.00   sinc( x ) = -00.054402   RFF(x) = -00.054262
x = -05.00   sinc( x ) = -00.191785   RFF(x) = -00.191805
x = -02.00   sinc( x ) = 000.454649   RFF(x) = 000.454844
x = -01.00   sinc( x ) = 000.841471   RFF(x) = 000.841588
x = 000.00   sinc( x ) = 001.000000   RFF(x) = 000.999822
x = 001.00   sinc( x ) = 000.841471   RFF(x) = 000.841236
x = 002.00   sinc( x ) = 000.454649   RFF(x) = 000.454716
x = 005.00   sinc( x ) = -00.191785   RFF(x) = -00.192080
x = 010.00   sinc( x ) = -00.054402   RFF(x) = -00.053250

Training MSE  = 5.28264e-08
Training RMSE = 0.00022984

License

MIT Open Source License

Have fun

Best regards,
Joao Carvalho