Skip to content

Instantly share code, notes, and snippets.

@dnouri
Created March 5, 2013 22:32
Show Gist options
  • Save dnouri/5094955 to your computer and use it in GitHub Desktop.
Save dnouri/5094955 to your computer and use it in GitHub Desktop.
This little #sklearn transform is pretty useful for applying arbitrary funcs to your data in a pipeline, like 1/X.
class Func(BaseEstimator):
def __init__(self, func):
self.func = func
def fit(self, X, y=None):
return self
def transform(self, X):
return self.func(X)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment