This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plt.axhline(ana,lw=2,color='green',label='Analytical solution') | |
plt.plot(range(1000,100000,1000),mutual_information,label='With scikit-learn function') | |
plt.xlabel('No of samples') | |
plt.ylabel('Mutual information') | |
plt.legend() | |
plt.savefig('Mutual_information_convergence_test.png',dpi=300) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.feature_selection import mutual_info_regression as MIR | |
mutual_information = [] | |
for i in range(1000,100000,1000): | |
distr = multivariate_normal(mean=mean,cov=cov,size=i) | |
X,Y = distr[:,0],distr[:,1] | |
mutual_information.append(MIR(X.reshape(-1,1),Y)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mean = np.array([0,0]) | |
rho=0.8 | |
cov = np.array([[1,rho],[rho,1]]) | |
distr = multivariate_normal(mean=mean,cov=cov,size=5000) | |
X,Y = distr[:,0],distr[:,1] |