Now let's build our preprocessing pipelines.
Import BaseEstimator and TransformerMixin from sklearn.base
from << your code goes here >> import << your code goes here >>
Now let's create the Pipeline.
class DataFrameSelector(BaseEstimator, TransformerMixin):
def __init__(self, attribute_names):
self.attribute_names = attribute_names
def fit(self, X, y=None):
return self
def transform(self, X):
return X[self.attribute_names]
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Please login to comment
0 Comments
There are 9 new comments.