mlogloss {rfVarImpOOB}R Documentation

computes log loss for multiclass problem

Description

computes log loss for multiclass problem

Usage

mlogloss(actual, pred_m, eps = 0.001)

Arguments

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

Author(s)

Markus Loecher <Markus.Loecher@gmail.com>

Examples






# 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)



[Package rfVarImpOOB version 1.0.3 Index]