Interpolation, approximation and the like (alglib package) - page 9

 
Nikolai Semko:

You seem to have a misunderstanding of the meaning of decomposing a function into harmonics.
Which left edge carries over to the right edge? What do you mean?

You understand that the point of Fourier decomposition is to get a set of harmonics (sinusoids) of different frequency, amplitude and phase shift, so that when you add them up you get something similar to the original function from the data set.

Each sinusoid is like an infinite function and has neither a left edge nor a right edge. To extrapolate it, you just have to continue it, not join the "left" edge to the "right" edge.

And the periodicity of this harmonic sum will not be equal to the sampling range of the original approximated data, but will be equal to the distance between the moments when all harmonics of different frequency phase shifts simultaneously return to the starting values, and not the fact that it can happen, because it can happen only if all harmonics frequencies are multiples of the same value.

The blue line is the approximation, the red line is the extrapolation.

The point of a Fourier series expansion is to represent a tabularly defined function by a harmonic series (some set of basis functions). It was especially popular as long as it was integrated by hand.
Read again the definitions and conditions for the existence of the series. It will converge to the function only under the stated conditions. And this is possible for periodic functions.
The physical essence of the method seems to elude you. Selecting a part of harmonics, of course, you will get at extrapolation values other than periodic, but it will be an error of function approximation method, which will be accurate in the limit, when selecting all the harmonics. But if you select all harmonics, you will get a periodic function.
Read something about the eigenvalue problem - it's physically the same thing: you're trying to find a basis for representing the function in question by a combination of basis functions. Only the Fourier series is a special case of such a decomposition.
Like it or not, when you do a Fourier series expansion you are already assuming that the function is periodic with a period equal to the interval over which you are doing the expansion. Otherwise the expansion simply does not converge to the function being approximated. Naturally, by selecting only a part of harmonics you will get some numbers. But the reliability is questionable - it is impossible to estimate the approximation error a priori.
And it turns out that for different scenarios of the function behavior over the right edge (during extrapolation), different sets of harmonics should have been taken in different cases. But it becomes known after the fact.

 
Maxim Dmitrievsky:

...

The challenge for you is to figure out how to redo any kernel from the article for n vectors instead of 2. That's it.

This is what the Gramm matrix is used for :O)

 
Dmitry Fedoseev:

That's what the Gramm matrix is used for :O)

No, Gramm's.

 
Maxim Dmitrievsky:

No, Grama.

On this issue, society has somehow not yet reached a consensus.

 
Dmitry Fedoseev:

The public has not yet reached a consensus on this issue.

Who cares, in fact, write, I'm fed up :) I just found out about this name yesterday.

There is an example in Matlab

https://stackoverflow.com/questions/33660799/feature-mapping-using-multi-variable-polynomial

I would like to make such a library with the most popular kernels, for mql

Feature mapping using multi-variable polynomial
Feature mapping using multi-variable polynomial
  • stackoverflow.com
Consider we have a data-matrix of data points and we are interested to map those data points into a higher dimensional feature space. We can do this by using d-degree polynomials. Thus for a sequence of data points the new data-matrix is I have studied a relevant script (Andrew Ng. online course) that make such a transform for 2-dimensional...
 
Vladyslav Goshkov:

The point of Fourier series expansion is to represent a tabulated function by a harmonic series (some set of basis functions). It was especially popular as long as it was integrated by hand.
Read again the definitions and conditions for the existence of the series. It will converge to the function only under the stated conditions. And this is possible for periodic functions.
The physical essence of the method seems to elude you. Selecting a part of harmonics, you will naturally get values different from periodic ones during extrapolation, but it will be an error of function approximation method, which will be accurate in the limit, if all harmonics are selected. But if you select all harmonics, you will get a periodic function.
Read something about the eigenvalue problem - it is physically the same thing: you are trying to find a basis for representing the function in question by a combination of basis functions. Only the Fourier series is a special case of such a decomposition.
Like it or not, when you do a Fourier series expansion you are already assuming that the function is periodic with a period equal to the interval over which you are doing the expansion. Otherwise the expansion simply does not converge to the function being approximated. Naturally, by selecting only a part of harmonics you will get some numbers. But the reliability is questionable - it is impossible to estimate the approximation error a priori.
And it turns out that for different scenarios of the function behavior over the right edge (during extrapolation), different sets of harmonics should have been taken in different cases. But it becomes known after the fact.

What do you mean by "all harmonics"? All harmonics means infinity of harmonics.

Do you even understand the meaning of these formulas?

You are mega wrong about "the function is periodic with a period equal to the interval you are doing the decomposition on".
Experiment with the code with diligence and see for yourself.

 
Nikolai Semko:

What do you mean by "all harmonics"? All harmonics means infinity of harmonics.

Do you understand the meaning of these formulas?

You are mega wrong about "that the function is periodic with a period equal to the interval on which you do the decomposition".
Experiment with the code with diligence and see for yourself.

Of course an infinite number. That's why I wrote that in the limit. By selecting part of the harmonics, you have approximation error, which cannot be estimated a priori. Reread the definitions and convergence conditions carefully - I'm not wrong about anything.

 
Maxim Dmitrievsky:

Who cares at all, basically write, I'm sick of it :) I just found out about the name yesterday.

There's an example in Matlab

https://stackoverflow.com/questions/33660799/feature-mapping-using-multi-variable-polynomial

I'd like to make such a library with the most popular kernels, for mql

А... When did you first see this article? Are you sure you understand everything it says correctly?

 
Dmitry Fedoseev:

А... When did you first see this article? Are you sure you understand everything it says correctly?

This one about a week ago. Yeah, I got it right.

 
Vladyslav Goshkov:

Of course an infinite number. That's why I wrote that in the limit. By selecting a part of harmonics you have approximation error which cannot be estimated a priori. Read carefully the definitions and convergence conditions - I am not wrong.

Honestly - you are talking some nonsense.
If the function is periodic with a period equal to the interval of decomposition, then why do we need approximation and extrapolation at all?

Just copy the last 1000 bars and paste it to the right last bar and voila, the forecast is ready.