entropy: Calculates Shannon's entropy

Description Usage Arguments Value Examples

Description

Formula: H(S) = -P_i * ∑ log_2 * P_i, where P_i is the probability of the corresponding i-th class

Usage

1
entropy(df, classAtt)

Arguments

df

A discrete data.frame

classAtt

A class column of the df (string)

Value

The Shannon's entropy of the df, based on the classAtt attribute

Examples

1
entropy(golf, "Play")

Example output

Loading required package: dplyr

Attaching package:dplyrThe following objects are masked frompackage:stats:

    filter, lag

The following objects are masked frompackage:base:

    intersect, setdiff, setequal, union

Loading required package: DiagrammeR
Loading required package: DiagrammeRsvg
Loading required package: rsvg
Loading required package: gtools
[1] 0.9401648

integr documentation built on May 24, 2019, 5:06 p.m.