用Python计算MIC值

import numpy as np
from minepy import MINE
import matplotlib.pyplot as plt

def print_stats(mine):
    print "MIC", mine.mic()
x = np.linspace(0, 1, 1000)
y = np.sin(10 * np.pi * x) + x
mine = MINE(alpha=0.6, c=15)
mine.compute_score(x, y)
plt.scatter(x, y,  color='black')
plt.show()
print "Without noise:"
print_stats(mine)
print

np.random.seed(0)
y +=np.random.uniform(-1, 1, x.shape[0]) # add some noise
plt.scatter(x, y,  color='black')
plt.show()
mine.compute_score(x, y)

print "With noise:"
print_stats(mine)

你可能感兴趣的:(Python-MIC)