Cross-entropy in R

The cross entropy method is a general approach to optimization that relies in two nice ideas. In the context of finding the maximum of a scalar-valued function this means: Generate some random parameters and evaluate the function there. Use the best values of the parameter to generate new candidates. One simple way of generating such […]

Set RStudio path to your file’s directory

Do you hate clicking in several places in RStudio to set up your working directory correctly? Or even worse, hard-coding it and have all your code break when you move your working folder? There is a one-line trick to set up the working directory in RStudio to your current directory: setwd(dirname(rstudioapi::getActiveDocumentContext()$path)) But first, you need […]