Description Usage Arguments Value Author(s) Examples
Computes the optimal weights to obtain the minimal loss function from a list of prediction matrices.
1 | optimize_weights(predictionlist, outcome, FUN = trps)
|
predictionlist |
A list of R x T prediction matrices where each column sum to 1 and each row sums to |
outcome |
An integer vector listing the |
FUN |
The function used for optimizing the predictions. The default is top use rps for the rank probability score. Another option is logloss for log loss. |
Returns a numeric vector containing an optimal vector of weights that sum to 1 and that minimizes the loss function.
Claus Ekstrom ekstrom@sund.ku.dk
1 2 3 4 5 6 7 8 9 | m1 <- matrix(c(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, .5, .5, 0, 0, .5, .5), 4)
m1 # Prediction where certain on the top ranks
m2 <- matrix(c(.5, .5, 0, 0, .5, .5, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), 4)
m2 # Prediction where the groups are okay
m3 <- matrix(c(.5, .5, 0, 0, .5, .5, 0, 0, 0, 0, .5, .5, 0, 0, .5, .5), 4)
m3 # Prediction where no clue about anything
m4 <- matrix(rep(1/4, 16), 4)
optimize_weights(list(m1, m2, m3, m4), 1:4)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.