如果有很多自变量,我们能在很多自变量中选出几个对因变量影响最大的吗?或许MIC可以解决这个问题哦。
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 14 19:52:57 2016
@author: Luyixiao
"""
import numpy as np
from minepy import MINE
import matplotlib.pyplot as plt
def print_stats(mine):
print "MIC", mine.mic()
# print "MAS", mine.mas()#detecting periodic relationships with unknown frequencies
# print "MEV", mine.mev()
# print "MCN (eps=0)", mine.mcn(0)
# print "MCN (eps=1-MIC)", mine.mcn_general()
x1 = np.linspace(0, 1, 1000)
x2 = np.random.randn(x1.shape[0])+0.5
x3 = np.random.randn(x1.shape[0])#normal mean = 0,dev = 1
x4 = np.random.random_sample(x1.shape[0])#random
x5 = 2*np.random.randn(x1.shape[0])+10 #normal mean = 10,dev = 2
x6 = 4*np.random.random_sample(x1.shape[0])#random*4
y = np.sin(10 * np.pi * x1) + x2
#y = np.si