I wondered if there were packages that allow the user to customise the loss function?
For example, if a package like ranger had a loss function which minimises OOB MSE. Is it somehow possible to customise this into a model which minimises negative loglikelihood?
I know ranger does allow it. There is a published example where the authors have calculated the -loglik for their own model, alongside the ranger model.
However, it's not something you can do within the context of ranger itself. I think it has to be generated using another package. I just wondered if you knew of examples (ranger or otherwise), where customised loss functions can be imposed on a model?
Such as transforming the objective from minimising MSE, to minimising -loglik.
caret::trainControl has an arguments metric and summaryFunction that together give you a variety of options. The package gives you a variety of summaryFunctions for various types of problems to identify optimal R2, RMSE, Accuracy, Kappa etc. , but I believe you can also write your own summaryFunction.