Machine learning in trading: theory, models, practice and algo-trading - page 205

 
ivanivan_11:

You will probably be offered to use these functions yourself if necessary https://www.mql5.com/ru/docs/opencl.

I have an old video card, OpenCL doesn't seem to support it. If they shove support right into the library, what will happen?

So I was talking about what would be the ability to choose to support both the vision, as well as other cores of the processor, or not to use OpenCL at all. It's just a real opportunity to see how to use OpenCL effectively.

 

When we get to heavy calculations, maybe we will use OpenCL. But something tells me that using multicore CPU will give acceptable results and more guaranteed.

For now there is no question about acceleration. We are working on the basic functionality of the libraries.

 
Dr.Trader:

According to the formula in the R help file, this is calculated using the formula
f(x)= 1/(s^a Gamma(a)) x^(a-1) e^-(x/s)
(shape= a and scale= s,forx ≥ 0,a > 0 ands > 0)
scale is 1/rate by default

The problem is that in this case x^(a-1) = 0^(1-1) = 0^0 that is undefined, i.e. there is no point in calling a function with such a parameter and there is no point in comparing results with other software. For 0^0 in different software can be different, depending on the religion of the developers.
This is in the software sense of 0^0. In the mathematical sense here lim(x^0), at x->0 - and this is unambiguously one
 

Dr.Trader:
The supposed error is that

dgamma(x=0, shape=1, rate=1,log=FALSE)== 1

According to the formula in the R help file, this is calculated using the formula
f(x)= 1/(s^a Gamma(a)) x^(a-1) e^-(x/s)
(shape= a and scale= s,forx ≥ 0,a > 0 ands > 0)
scale is 1/rate by default

The problem is that in this case x^(a-1) = 0^(1-1) = 0^0, which is undefined, i.e. there is no point in calling a function with this parameter and there is no point in comparing results with other software. For 0^0 in different software can be different, depending on the religion of the developers.

Great. It turns out that we can't call it a definition, since there are uncertainties.

You can build a graph and make sure that at the point x=0 the expression at these parameters tends to 1. This is a normal number, there is no divergence at other points.

We can sum the whole density, the result is some number (the normalization factor), by which we divide and get the unit probability, which is smeared out over the area of definition. The curve is normalized, the area under the curve = 1. In this case we can talk about probability density.

However, with parameters 0.5 and 1 at the point x=0 the situation is different. The limit value at this point is equal to infinity. When approaching 0 it tends to infinity. It is possible not to integrate after this point, the result will not change. How to normalize to infinity? With this normalization, any curve becomes a line.

But if we consider the expression to work only when x>0, then the expression can be viewed as the definition of the function, since there are no uncertainties at x=0. All values are finite and nothing breaks.

This hypothesis explains the results that Mathematica and Matlab produce: at point x=0, density=0.

This was the question.

 
Renat Fatkhullin:

When we get to heavy calculations, maybe we will use OpenCL. But something tells me that using multicore CPU will give acceptable results and more guaranteed.

For now there is no question about acceleration. We are busy tweaking the basic functionality of the libraries.

Got it. I will wait for developments.

 
Quantum:

Great. It turns out that we can't call it a definition, since there are uncertainties.

You can plot the graph and make sure that at the point x=0 the expression tends to 1 with these parameters. This is a normal number, there is no divergence at other points.

We can sum all the densities, resulting in some number (the normalization factor), by which we divide and get the unit probability, which is smeared over the area of the definition. The curve is normalized, the area under the curve = 1. In this case we can talk about probability density.

However, the situation with parameters 0.5 and 1 at x=0 is different. The limit value at this point is equal to infinity. When approaching 0 it tends to infinity. It is possible not to integrate after this point, the result will not change. How to normalize to infinity? With this normalization, any curve becomes a line.

But if we consider the expression to work only when x>0, then the expression can be viewed as the definition of the function, since there are no uncertainties at x=0. All values are finite and nothing breaks down.

This hypothesis explains the results that Mathematica and Matlab produce: at point x=0, density=0.

That was the question.

This function is what is defined at (0,inf). or do you disagree with that?

Second. Since the probability distribution function is perfectly defined on the specified domain, is there any sense in assigning any value 0, 1, inf to the density at point 0, and calling one of such values an error?

No, I don't have any complaints about the 0 value. Will you personally, as the author of the function code, answer the programmers of R for what you said about their function dgamma being incorrect?
 
My colleagues and I checked dgamma after reading the article. Your revelations have not and can not affect the results of the research done. And a person who doesn't know much about it might think that R is doing the calculations wrong. Did you deliberately do it for this purpose? This only applies to dgamma.

Next.

I have a personal question for you. Dirac Function. Delta Function. It is equal to infinity at point 0, at other points it is equal to zero. Its integral on the domain -inf to +inf = 1. Why would there be a problem with the integral of the gamma function on its domain if at zero the density is equal to infinity?
 
Alexey Burnakov:

I have a personal question for you. Dirac Function. Delta Function. It is equal to infinity at point 0, at other points it is equal to zero. Its integral on the domain -inf to +inf = 1. Why would there be a problem with the integral of the gamma function on its domain if at zero the density is equal to infinity?

Are you saying that this kind of transformation to the Dirac delta function is OK? What is the point of everything else?

Tell me what happens to infinity in the pgamma process at point x=0, when the "correct" (as you say) answer in dgamma(0,0.5,1)=+inf has been given.

Show graphically the function and integration ranges when calculating pgamma.

 

Interesting fact.

The definitions of gamma distribution density values in the Russian translation of

Johnson N.L., Kotz S., Balakrishnan N. Univariate Continuous Distributions. part 1 and the earlier English version are different:



but the English version has a suspected typo due to different signs.

 
Quantum:

Are you saying that this kind of transformation into a Dirac delta function is OK? What's the point of everything else then?

Tell me what happens to infinity in the pgamma process at x=0 when the "correct" as you say answer in dgamma(0,0.5,1)=+inf was given.
I read the Pgamma documentation. as I understand it is not related to dgamma. its counterpart is different.

No, I'm not going to tell you what I don't know for sure.
... I gave an example where for density = infinity the integral = 1. Since there are zeros on the rest of the area ...

And another question for you.

I took Excel. There is a gamma.race function there too. counts density if cumulative = false. for x = 0 the function outputs a value of #number! From the help:In Excel, this error occurs when a formula or function contains an invalid numeric value.

Does Excel get this error as well? Following your logic. You can compete with them in wit too.

In addition, add to your article mentioning that the stat.function for gamma distribution in Python returns similar R values, and call the feuilleton as follows: There are plenty of programs around that spoil your research with errors, and in MT we solved all your mistakes.

And by the way, add a section on the conventions adopted in MT5 for non-calculable values.

And I'm waiting for moderation of my question in R Core and their answer. Although I know what it will be... and then I'll retire.
Reason: