gini_impurity: Gini impurity

View source: R/deepMetrics.r

gini_impurityR Documentation

Gini impurity

Description

Gini impurity

Usage

gini_impurity(x)

Arguments

x

A vector of values, usually character labels as raw instances or as class frequencies.

Details

Gini impurity is the probability of how often a randomly chosen element from a set x would be incorrectly labeled if it was randomly labeled according to the distribution of labels in the set. So, impurity is the probability of being incorrect if a label is randomly assigned to a sample of x.

Value

The Gini impurity.

References

https://victorzhou.com/blog/gini-impurity/

See Also

Other Metrics: accuracy(), cross_entropy(), dice(), entropy(), erf(), erfc(), erfcinv(), erfinv(), huber_loss(), iou(), log_cosh_loss(), mae(), mape(), mse(), msle(), quantile_loss(), rmse(), rmsle(), rmspe(), sse(), stderror(), vc(), wape(), wmape()

Examples

  gini_impurity(c("dog", "dog", "cat", "mouse"))
  gini_impurity(c(dog = 2, cat = 1, mouse = 1))

stschn/deepANN documentation built on June 25, 2024, 7:27 a.m.