Created
October 12, 2015 08:33
-
-
Save calippo/9f726ef197b36d6e9f39 to your computer and use it in GitHub Desktop.
[pandas, scikit-learn] Feature selection using low variance
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
def varianceSelection(X, THRESHOLD = .95): | |
sel = VarianceThreshold(threshold=(THRESHOLD * (1 - THRESHOLD))) | |
sel.fit_transform(X) | |
return X[[c for (s, c) in zip(sel.get_support(), X.columns.values) if s]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment