<s> """<STR_LIT>""" <EOL> from . decorators import deprecated <EOL> from sklearn . base import BaseEstimator , TransformerMixin <EOL> __all__ = [ '<STR_LIT>' ] <EOL> class FeatureExtractor ( BaseEstimator , TransformerMixin ) : <EOL> """<STR_LIT>""" <EOL> @ deprecated ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def __init__ ( self , function , target = None , iterate = True , ** kwargs ) : <EOL> '''<STR_LIT>''' <EOL> self . function = function <EOL> self . target = target <EOL> self . iterate = iterate <EOL> self . kwargs = { } <EOL> self . set_params ( ** kwargs ) <EOL> def _get_param_names ( self ) : <EOL> """<STR_LIT>""" <EOL> temp_params = { '<STR_LIT>' : self . function , '<STR_LIT:target>' : self . target } <EOL> temp_params . update ( self . kwargs ) <EOL> return temp_params <EOL> def set_params ( self , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> params = kwargs . copy ( ) <EOL> for k in [ '<STR_LIT>' , '<STR_LIT:target>' ] : <EOL> params . pop ( k , None ) <EOL> self . kwargs . update ( params ) <EOL> BaseEstimator . set_params ( self , ** kwargs ) <EOL> def fit ( self , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> return self <EOL> def transform ( self , X ) : <EOL> """<STR_LIT>""" <EOL> if self . target is not None : <EOL> if self . iterate : <EOL> return [ self . function ( ** dict ( list ( self . kwargs . items ( ) ) <EOL> + list ( { self . target : i } . items ( ) ) ) ) <EOL> for i in X ] <EOL> else : <EOL> return self . function ( ** dict ( list ( self . kwargs . items ( ) ) <EOL> + list ( { self . target : X } . items ( ) ) ) ) <EOL> else : <EOL> if self . iterate : <EOL> return [ self . function ( i , ** self . kwargs ) for i in X ] <EOL> else : <EOL> return self . function ( X , ** self . kwargs ) </s>
