This file contains hidden or 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
| SOURCE http://blog.datadive.net/selecting-good-features-part-ii-linear-models-and-regularization/ | |
| # Correlation | |
| import numpy as np | |
| from scipy.stats import pearsonr | |
| np.random.seed(0) | |
| size = 300 | |
| x = np.random.normal(0, 1, size) | |
| print "Lower noise", pearsonr(x, x + np.random.normal(0, 1, size)) | |
| print "Higher noise", pearsonr(x, x + np.random.normal(0, 10, size)) |
This file contains hidden or 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
| import numpy as np | |
| from sklearn import datasets | |
| # sigmoid function | |
| def activation(x,derivative=False): | |
| if(derivative==True): | |
| return x*(1-x) | |
| return 1/(1+np.exp(-x)) | |
| iris = datasets.load_iris() |
OlderNewer