Learn R Programming

modello (version 0.1.1)

bin.entropy.modello_number: Binary Entropy

Description

Entropy for binary target variables (Negative Bernoulli Log-Likelihood) $$h = \sum_i{-y_i * log(\hat y_i) - (1- y_i) * log(1 - \hat y_i)}$$

Usage

# S3 method for modello_number
bin.entropy(y, yh)

# S3 method for default bin.entropy(y, yh)

bin.entropy(y, yh)

Arguments

y

predicted probability

yh

target classes (0 or 1)

Value

Returns the entropy

Examples

Run this code
# NOT RUN {
modello.init(10, 10, 10, 10)
## For modello_numbers
y = number(sample(c(1, 0), 10, replace=TRUE), dx=FALSE)
yh = number(runif(10))
h = bin.entropy(y, yh)
print(h)
print(h$v)
modello.close()
## For numerics
y = sample(c(1, 0), 10, replace=TRUE)
yh = runif(10)
h = bin.entropy(y, yh)
print(h)
# }

Run the code above in your browser using DataLab