Description Usage Arguments Value See Also Examples
View source: R/metric_nloglik.R
Returns the negative log likelihood for the predictions. Note: Predictions should be annualized (independent of exposure) Note: Large negative values are good. (function should be minimised)
1 2 3 4 5 6 7 8 9 |
actual |
Array[Numeric] - Values we are aiming to predict. |
predicted |
Array[Numeric] - Values that we have predicted. |
weight |
Optional: Array[Numeric] - Weighting of predictions. If NULL even weighting is used |
family |
String - family of distribution. Must be in |
na.rm |
Optional: boolean - If |
rebase |
Optional: boolean - If |
tweedie_power |
Numeric - power of tweedie distribution if chosen in |
Numeric: negative log likelihood
Other Metrics:
metric_deviance()
,
metric_mae()
,
metric_pode()
,
metric_pove()
,
metric_rmse()
1 2 3 4 5 6 7 8 9 | set.seed(666)
actual <- pmax(rep(10, 10), 0)
predicted <- pmax(rnorm(n = 10, mean = 10, sd = 1), 0)
weight <- pmax(rnorm(n = 10, mean = 10, sd = 1), 0)
metric_nloglik(actual, predicted, family="poisson")
metric_nloglik(actual, predicted, weight, family="poisson")
metric_nloglik(actual, predicted, weight, family="gamma")
metric_nloglik(actual=c(rep(0,5), rep(1,5)), predicted=seq(0.01,0.99,length.out=10), weight, family="binomial")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.