Created
March 5, 2013 22:32
-
-
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.
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
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