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

 
Aleksey Nikolayev #:
Also, theoretically, you can have an array of functions.

What's that? Like making a matrix and an interpreter?

 
Aleksey Vyazmikin #:

I don't know R syntax - just checked that there is such a possibility there too. But yeah, it looks like it.

It's C++.

 
Aleksey Nikolayev #:

Judging by the type x, it is Rcpp. In C++ you can make arrays of pointers to functions and there will be an immediate call of the required function by index, but with the switch it seems to be a sequential search from the beginning to the required variant. Of course, the problem of generating the code of all these functions remains and it is unclear how it will work with Rcpp.

About pointers to functions and their arrays in C++.

And there seems to be no brute force...

 
mytarmailS #:

this is C++

That's why I made the caveat.

Chat GPT offers some kind of syntax like this

#  Создаем функцию, имитирующую оператор switch
my_switch <- function(x) {
  switch(x,
         case1 = {
           #  Действия, выполняемые при совпадении с "case1"
           print("Это case1")
         },
         case2 = {
           #  Действия, выполняемые при совпадении с "case2"
           print("Это case2")
         },
         default = {
           #  Действия по умолчанию, если нет совпадения с другими случаями
           print("Это default")
         }
  )
}
 
Aleksey Nikolayev #:

Judging by the type x, it's rcpp.

Yes, it is.

I'll try to test it for speed

switch

If it doesn't work, I'm going to delve into

pointers to functions and their arrays
 
Aleksey Vyazmikin #:

And there doesn't seem to be any overkill...

Maybe not, I don't remember exactly.
 
mytarmailS #:

Yes, it is.

I'll try to test it for speed.

If it doesn't work, I'm going to delve into

pointers to functions and their arrays
If all functions are linear, as in the example, you can simply use a regular two-dimensional matrix of coefficients. You can also do volume compression if the matrix is sparse.
 
Maxim Dmitrievsky #:

Sanych said there were no extremes there, and he was right.

Yes, Sanych wrote that there are no extrema there, and he was wrong, because any function has extrema.

Extrema is the point at which a function reaches the largest (maximum) or smallest (minimum) value on a given interval or in a given area. Extremes can be local, when the function reaches an extreme value only in some neighbourhood of a point, or global, when the function reaches an extreme value over the entire given interval or in a given area.

Extremes are always there, even if you don't look for them intentionally (the algorithms you use do this search operation for you). Learning without optimisation is impossible, and optimisation is impossible without correct FF assignments. If the search for extrema is done for you and hidden (sewn into the algorithm), it doesn't mean that they don't exist (both extrema and optimisation).
 
Aleksey Nikolayev #:
If all functions are linear, as in the example, you can simply use a regular two-dimensional matrix of coefficients. You can also do volume compression if the matrix is sparse.

No, they're not linear, you're supposed to cram much more complex code into each function...

There's no problem with that in R, you can do whatever you want, but speed(((.

I'm looking for a way to do it in C++.

 
Andrey Dik #:

Yes, Sanych wrote that there are no extrema there, and he was wrong, because any function has extrema.

Extrema is the point at which a function reaches the largest (maximum) or smallest (minimum) value on a given interval or in a given area. Extremes can be local, when the function reaches an extreme value only in some neighbourhood of a point, or global, when the function reaches an extreme value over the entire given interval or in a given area.

Extremes are always there, even if you don't look for them intentionally (the algorithms you use do this search operation for you). Learning without optimisation is impossible, and optimisation is impossible without correct FF assignments. If the search for extrema is done for you and hidden (sewn into the algorithm), it doesn't mean that they don't exist (both extrema and optimisation).

There is no function there.

please, enough, past the box office info. I know what optimisation is.