Description Usage Arguments Author(s) Examples
computes log loss for multiclass problem
1 | mlogloss(actual, pred_m, eps = 0.001)
|
actual |
integer vector with truth labels, values range from 0 to n - 1 classes |
pred_m |
predicted probs: column 1 => label 0, column 2 => label 1 and so on |
eps |
numerical cutoff taken very high |
Markus Loecher <Markus.Loecher@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | # require(nnet)
# set.seed(1)
# actual = as.integer(iris$Species) - 1
# fit = nnet(Species ~ ., data = iris, size = 2)
# pred = predict(fit, iris)#note this is a 3-column prediction matrix!
#
# mlogloss(actual, pred) # 0.03967
#library(titanic)
#baseline prediction
#data(titanic_train, package="titanic")
yHat = mean(titanic_train$Survived)#0.383838
mlogloss(titanic_train$Survived,yHat)
#try factors
titanic_train$Survived = as.factor(titanic_train$Survived)
mlogloss(titanic_train$Survived,yHat)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.