spkit.entropy_diff_joint

spkit.entropy_diff_joint(X, Y)

Differential Joint Entropy \(H_{\partial}(X,Y)\)

Differential Joint Entropy with

\[H_{\partial}(X,Y)\]
Parameters:
X: 2d-array, 1d-array
  • multi-dimentional signal space, where each column (axis=1) are the delayed signals

  • or 1d-dimensional signal

Y: 2d-array, 1d-array
  • multi-dimentional signal space, where each column (axis=1) are the delayed signals

  • or 1d-dimensional signal

Returns:
H_xy: scaler
  • Differential Joint Entropy

See also

entropy_diff_cond_self

Self-Conditional Entropy

entropy_diff_cond

Conditional Entropy

References

  • wiki

Examples

# Example 1
#sp.entropy_diff_joint
import numpy as np
import matplotlib.pyplot as plt
import spkit as sp
X, fs, ch_names = sp.data.eeg_sample_14ch()
X = X - X.mean(1)[:, None]
X1 = sp.signal_delayed_space(X[:,0].copy(),emb_dim=5,delay=2)
Y1 = sp.signal_delayed_space(X[:,2].copy(),emb_dim=5,delay=2)
Y2 = sp.add_noise(Y1,snr_db=0)
H_xy1 = sp.entropy_diff_joint(X1,Y1)
H_xy2 = sp.entropy_diff_joint(X1,Y2)
print('Conditional Entropy')
print(f'- H(X1,Y1) = {H_xy1}')
print(f'- H(X1,Y2) = {H_xy2}')

#############################
# Example 2
import numpy as np
import matplotlib.pyplot as plt
import spkit as sp
X, fs, ch_names = sp.data.eeg_sample_14ch()
X = X - X.mean(1)[:, None]
x1,y1 = X[:,0].copy(),X[:,2].copy()
#x1 = x1[:,None]
#y1 = y1[:,None]
y2 = sp.add_noise(y1,snr_db=0)
H_xy1 = sp.entropy_diff_joint(x1,y1)
H_xy2 = sp.entropy_diff_joint(x1,y2)
print('Conditional Entropy')
print(f'- H(X1,Y1) = {H_xy1}')
print(f'- H(X1,Y2) = {H_xy2}')