Created
August 26, 2016 13:39
-
-
Save jmansilla/79929c66e05a075a84042b8f0d7583d8 to your computer and use it in GitHub Desktop.
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
import numpy as np | |
class DirectTransformer: | |
"""Utility for building class-like features from a single-point function, but that may need | |
some general configuration first (you usually override __init__ for that) | |
""" | |
def fit(self, X, y=None): | |
return self | |
def transform(self, X): | |
return np.array([self.transform_one(x) for x in X]).reshape((-1, 1)) | |
def transform_one(self, x): | |
raise NotImplementedError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment