(self, step, **kwargs)
Output useful information to stdout and the log file if debugging is required.
        step: Print the corresponding step in the log
        kwargs: dictionary of dataframes to be used in the log
Output useful information to stdout and the log file if debugging is required.
        step: Print the corresponding step in the log
        kwargs: dictionary of dataframes to be used in the log
Output useful information to stdout and the log file if debugging is required . step : Print the corresponding step in the log kwargs : dictionary of dataframes to be used in the log
def _print_log(self, step, **kwargs):
        """
        Output useful information to stdout and the log file if debugging is required.
        step: Print the corresponding step in the log
        kwargs: dictionary of dataframes to be used in the log
        """
        
        if step == 1:
            if self.ohe:
                sys.stdout.write("Features for one hot encoding: \n{0}\n\n".format(self.ohe_meta))
                
                with open(self.log,'a', encoding='utf-8') as f:
                    f.write("Features for one hot encoding: \n{0}\n\n".format(self.ohe_meta))
            
            if self.hash:
                sys.stdout.write("Features for hashing: \n{0}\n\n".format(self.hash_meta))
                
                with open(self.log,'a', encoding='utf-8') as f:
                    f.write("Features for hashing: \n{0}\n\n".format(self.hash_meta))
            
            if self.cv:
                sys.stdout.write("Features for count vectorization: \n{0}\n\n".format(self.cv_meta))
                
                with open(self.log,'a', encoding='utf-8') as f:
                    f.write("Features for count vectorization: \n{0}\n\n".format(self.cv_meta))
            
            if self.tfidf:
                sys.stdout.write("Features for tfidf vectorization: \n{0}\n\n".format(self.tfidf_meta))
                
                with open(self.log,'a', encoding='utf-8') as f:
                    f.write("Features for tfidf vectorization: \n{0}\n\n".format(self.tfidf_meta))
            
            if self.scale:
                sys.stdout.write("Features for scaling: \n{0}\n\n".format(self.scale_meta))
                
                with open(self.log,'a', encoding='utf-8') as f:
                    f.write("Features for scaling: \n{0}\n\n".format(self.scale_meta))

        elif step == 2:
            if self.ohe:
                sys.stdout.write("Fit ohe_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['ohe_df'].shape, kwargs['ohe_df'].head()))
                
                with open(self.log,'a', encoding='utf-8') as f:
                    f.write("Fit ohe_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['ohe_df'].shape, kwargs['ohe_df'].head()))
            
            if self.hash:
                sys.stdout.write("Fit hash_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['hash_df'].shape, kwargs['hash_df'].head()))
                
                with open(self.log,'a', encoding='utf-8') as f:
                    f.write("Fit hash_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['hash_df'].shape, kwargs['hash_df'].head()))
            
            if self.cv:
                sys.stdout.write("Fit cv_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['cv_df'].shape, kwargs['cv_df'].head()))
                
                with open(self.log,'a', encoding='utf-8') as f:
                    f.write("Fit cv_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['cv_df'].shape, kwargs['cv_df'].head()))
            
            if self.tfidf:
                sys.stdout.write("Fit tfidf_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['tfidf_df'].shape, kwargs['tfidf_df'].head()))
                
                with open(self.log,'a', encoding='utf-8') as f:
                    f.write("Fit tfidf_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['tfidf_df'].shape, kwargs['tfidf_df'].head()))
            
            try:
                if len(kwargs['scale_df']) > 0:
                    sys.stdout.write("Fit scale_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['scale_df'].shape, kwargs['scale_df'].head()))
                    
                    with open(self.log,'a', encoding='utf-8') as f:
                        f.write("Fit scale_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['scale_df'].shape, kwargs['scale_df'].head()))
            except AttributeError:
                pass
        
        elif step == 3:
            if self.ohe:
                sys.stdout.write("Transform ohe_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['ohe_df'].shape, kwargs['ohe_df'].head()))
                
                with open(self.log,'a', encoding='utf-8') as f:
                    f.write("Transform ohe_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['ohe_df'].shape, kwargs['ohe_df'].head()))
            
            if self.hash:
                sys.stdout.write("Transform hash_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['hash_df'].shape, kwargs['hash_df'].head()))
                
                with open(self.log,'a', encoding='utf-8') as f:
                    f.write("Transform hash_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['hash_df'].shape, kwargs['hash_df'].head()))
            
            if self.cv:
                sys.stdout.write("Transform cv_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['cv_df'].shape, kwargs['cv_df'].head()))
                
                with open(self.log,'a', encoding='utf-8') as f:
                    f.write("Transform cv_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['cv_df'].shape, kwargs['cv_df'].head()))
            
            if self.tfidf:
                sys.stdout.write("Transform tfidf_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['tfidf_df'].shape, kwargs['tfidf_df'].head()))
                
                with open(self.log,'a', encoding='utf-8') as f:
                    f.write("Transform tfidf_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['tfidf_df'].shape, kwargs['tfidf_df'].head()))
            
            try:
                if len(kwargs['scale_df']) > 0:
                    sys.stdout.write("Transform scale_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['scale_df'].shape, kwargs['scale_df'].head()))
                    
                    with open(self.log,'a', encoding='utf-8') as f:
                        f.write("Transform scale_df shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['scale_df'].shape, kwargs['scale_df'].head()))
            except AttributeError:
                pass

            try:
                sys.stdout.write("X_transform shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['X_transform'].shape, kwargs['X_transform'].head()))
                    
                with open(self.log,'a', encoding='utf-8') as f:
                    f.write("X_transform shape:{0}\nSample Data:\n{1}\n\n".format(kwargs['X_transform'].shape, kwargs['X_transform'].head()))
            except AttributeError:
                pass
def _print_log ( self , step , * * kwargs ) : if step == 1 : if self . ohe : sys . stdout . write ( "Features for one hot encoding: \n{0}\n\n" . format ( self . ohe_meta ) ) with open ( self . log , 'a' , encoding = 'utf-8' ) as f : f . write ( "Features for one hot encoding: \n{0}\n\n" . format ( self . ohe_meta ) ) if self . hash : sys . stdout . write ( "Features for hashing: \n{0}\n\n" . format ( self . hash_meta ) ) with open ( self . log , 'a' , encoding = 'utf-8' ) as f : f . write ( "Features for hashing: \n{0}\n\n" . format ( self . hash_meta ) ) if self . cv : sys . stdout . write ( "Features for count vectorization: \n{0}\n\n" . format ( self . cv_meta ) ) with open ( self . log , 'a' , encoding = 'utf-8' ) as f : f . write ( "Features for count vectorization: \n{0}\n\n" . format ( self . cv_meta ) ) if self . tfidf : sys . stdout . write ( "Features for tfidf vectorization: \n{0}\n\n" . format ( self . tfidf_meta ) ) with open ( self . log , 'a' , encoding = 'utf-8' ) as f : f . write ( "Features for tfidf vectorization: \n{0}\n\n" . format ( self . tfidf_meta ) ) if self . scale : sys . stdout . write ( "Features for scaling: \n{0}\n\n" . format ( self . scale_meta ) ) with open ( self . log , 'a' , encoding = 'utf-8' ) as f : f . write ( "Features for scaling: \n{0}\n\n" . format ( self . scale_meta ) ) elif step == 2 : if self . ohe : sys . stdout . write ( "Fit ohe_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'ohe_df' ] . shape , kwargs [ 'ohe_df' ] . head ( ) ) ) with open ( self . log , 'a' , encoding = 'utf-8' ) as f : f . write ( "Fit ohe_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'ohe_df' ] . shape , kwargs [ 'ohe_df' ] . head ( ) ) ) if self . hash : sys . stdout . write ( "Fit hash_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'hash_df' ] . shape , kwargs [ 'hash_df' ] . head ( ) ) ) with open ( self . log , 'a' , encoding = 'utf-8' ) as f : f . write ( "Fit hash_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'hash_df' ] . shape , kwargs [ 'hash_df' ] . head ( ) ) ) if self . cv : sys . stdout . write ( "Fit cv_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'cv_df' ] . shape , kwargs [ 'cv_df' ] . head ( ) ) ) with open ( self . log , 'a' , encoding = 'utf-8' ) as f : f . write ( "Fit cv_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'cv_df' ] . shape , kwargs [ 'cv_df' ] . head ( ) ) ) if self . tfidf : sys . stdout . write ( "Fit tfidf_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'tfidf_df' ] . shape , kwargs [ 'tfidf_df' ] . head ( ) ) ) with open ( self . log , 'a' , encoding = 'utf-8' ) as f : f . write ( "Fit tfidf_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'tfidf_df' ] . shape , kwargs [ 'tfidf_df' ] . head ( ) ) ) try : if len ( kwargs [ 'scale_df' ] ) > 0 : sys . stdout . write ( "Fit scale_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'scale_df' ] . shape , kwargs [ 'scale_df' ] . head ( ) ) ) with open ( self . log , 'a' , encoding = 'utf-8' ) as f : f . write ( "Fit scale_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'scale_df' ] . shape , kwargs [ 'scale_df' ] . head ( ) ) ) except AttributeError : pass elif step == 3 : if self . ohe : sys . stdout . write ( "Transform ohe_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'ohe_df' ] . shape , kwargs [ 'ohe_df' ] . head ( ) ) ) with open ( self . log , 'a' , encoding = 'utf-8' ) as f : f . write ( "Transform ohe_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'ohe_df' ] . shape , kwargs [ 'ohe_df' ] . head ( ) ) ) if self . hash : sys . stdout . write ( "Transform hash_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'hash_df' ] . shape , kwargs [ 'hash_df' ] . head ( ) ) ) with open ( self . log , 'a' , encoding = 'utf-8' ) as f : f . write ( "Transform hash_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'hash_df' ] . shape , kwargs [ 'hash_df' ] . head ( ) ) ) if self . cv : sys . stdout . write ( "Transform cv_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'cv_df' ] . shape , kwargs [ 'cv_df' ] . head ( ) ) ) with open ( self . log , 'a' , encoding = 'utf-8' ) as f : f . write ( "Transform cv_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'cv_df' ] . shape , kwargs [ 'cv_df' ] . head ( ) ) ) if self . tfidf : sys . stdout . write ( "Transform tfidf_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'tfidf_df' ] . shape , kwargs [ 'tfidf_df' ] . head ( ) ) ) with open ( self . log , 'a' , encoding = 'utf-8' ) as f : f . write ( "Transform tfidf_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'tfidf_df' ] . shape , kwargs [ 'tfidf_df' ] . head ( ) ) ) try : if len ( kwargs [ 'scale_df' ] ) > 0 : sys . stdout . write ( "Transform scale_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'scale_df' ] . shape , kwargs [ 'scale_df' ] . head ( ) ) ) with open ( self . log , 'a' , encoding = 'utf-8' ) as f : f . write ( "Transform scale_df shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'scale_df' ] . shape , kwargs [ 'scale_df' ] . head ( ) ) ) except AttributeError : pass try : sys . stdout . write ( "X_transform shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'X_transform' ] . shape , kwargs [ 'X_transform' ] . head ( ) ) ) with open ( self . log , 'a' , encoding = 'utf-8' ) as f : f . write ( "X_transform shape:{0}\nSample Data:\n{1}\n\n" . format ( kwargs [ 'X_transform' ] . shape , kwargs [ 'X_transform' ] . head ( ) ) ) except AttributeError : pass