I am a bit confused about what exactly every function within this pipeline does. Can someone explain how this pipeline works? I know roughly how, but some clarification would be immensely helpful.
Why is capital 'X' used in def
transform(self, X)
?What's the point of
get_feature_names
and__init__
specifically?
Code:
class custom_fico(BaseEstimator,TransformerMixin):
def __init__(self):
self.feature_names = ['fico']
def fit(self,x,y=None):
return self
def transform(self,X):
k = X['FICO.Range'].str.split('-',expand = True).astype(float)
fico = 0.5 * (k[0] + k[1])
return pd.DataFrame({'fico':fico})
def get_feature_names(self):
return self.feature_names