sgd
sgd copied to clipboard
Allow user to specify generic loss function to do SGD on
This cannot be efficiently implemented in Rcpp. Rcpp cannot interface with the R function in any way other than calling it in R each time. Hence for now, we are using strings to match models specified by the user, which allows for faster computation using C++ functions. Later on, we will extend this where some model
argument in SGD can either be a string (uses C++ function on case-by-case basis) or a generic function (uses R function).
Look into how optim()
and gmm()
do this, since they're quite fast but also allow users to specify a generic function.
The optim()
and lapply()
in the built in r core package evaluates the user defined functions in R by calling the function in R. For now, we can also call the function in R with sacrifice in performance.