f_logit_cost {mactivate}R Documentation

Logistic Cost

Description

Calculate the logistic cost of probability predictions of a dichotomous outcome.

Usage

f_logit_cost(y, yhat)

Arguments

y

Numeric vector. The outcome vector. Must be in {0, 1}.

yhat

Numeric vector. Prediction vector. Should be in (0, 1) – the open unit interval. In an inferential setting, one should probably never make a prediction of zero or one; however, values of zero or one are allowed, provided they are “correct”.

Details

This function is included in this library as a convenience.

Value

A numeric vector of length equal to y and yhat. The logistic cost associated with each corresponding prediction.

See Also

f_fit_gradient_logistic_01, predict.mactivate_fit_gradient_logistic_01.

Examples

y <- c(0, 0, 1, 1)
yhat <- rep(1/2, length(y))

mean( f_logit_cost(y=y, yhat=yhat) )

[Package mactivate version 0.6.6 Index]