Skip to content

Instantly share code, notes, and snippets.

@hodzanassredin
Created December 25, 2015 14:14
Show Gist options
  • Save hodzanassredin/d7ba71af3b71bb749720 to your computer and use it in GitHub Desktop.
Save hodzanassredin/d7ba71af3b71bb749720 to your computer and use it in GitHub Desktop.
4x speedup in classification
from sklearn.feature_selection.base import SelectorMixin
#sklearn fix
def get_support(self, indices=False):
if hasattr(self, 'mask_cache'):
return self.mask_cache
mask = self._get_support_mask()
self.mask_cache = mask if not indices else np.where(mask)[0]
return self.mask_cache
SelectorMixin.get_support = get_support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment