File Exchange

image thumbnail

Conditional Entropy

version (1.38 KB) by Will Dwinnell
Calculates the conditional entropy of a discrete variable, given other discrete variables.


Updated 12 Sep 2010

View License

ConditionalEntropy: Calculates conditional entropy (in bits) of Y, given X

H = ConditionalEntropy(Y,X)

H = calculated entropy of Y, given X (in bits)
Y = dependent variable (column vector)
X = independent variable(s)

Note 1: Each distinct value is considered a unique symbol.

Note 2: requires 'Entropy' and 'MutualInformation' functions

Example: 'X' (1 bit of entropy), 'Y' (2 bits of entropy)
Given 'X', 'Y's conditional entropy is 1 bit.

Note: Estimated entropy values are slightly less than true, due to finite sample size.

Y = ceil(4 * rand(1e3,1)); X = double(Y <= 2);

Comments and Ratings (0)

MATLAB Release Compatibility
Created with R12
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor