build/lib/AutoMxL/__main__.py
def preprocess_apply(self, df, verbose=False):
        """Apply preprocessing.

        Requires preprocess method to have been applied (so that all encoder are fitted).

        Parameters
        ----------
        df : DataFrame
            dataset to apply preprocessing on
        verbose : boolean (Default False)
            Get logging information

        Returns
        -------
        DataFrame : Preprocessed dataset
        """
        if verbose:
            start_time = time()
            print_title1('Apply Preprocessing')

        # check pipe step and is_fitted
        assert self.is_fitted_preprocessing, "fit first (please)"

        #
        df_local = df.copy()

        # Remove features with zero variance / verbatims and identifiers
        if verbose:
            color_print("Remove features (zero variance, verbatims and identifiers")

        if len(self.d_preprocess['remove']) > 0:
            df_local = df_local.drop(self.d_preprocess['remove'], axis=1)
            if verbose:
                print("  >", len(self.d_preprocess['remove']), 'removed features')
        else:
            if verbose:
                print("  > No features to remove")

        # Transform date -> time between date and date_ref
        if verbose:
            color_print("Transform date")
        df_local = self.d_preprocess['date'].transform(df_local, verbose=verbose)

        # Missing Values
        if verbose:
            color_print('Missing values')
        df_local = self.d_preprocess['NA'].transform(df_local, verbose=verbose)

        # replace outliers
        if 'outlier' in list(self.d_preprocess.keys()):
            if verbose:
                color_print('Outliers')
            df_local = self.d_preprocess['outlier'].transform(df_local, verbose=verbose)

        # categorical processing
        if verbose:
            color_print('Encode categorical and boolean')
            print('\n\t\t>>>', 'preprocess_apply execution time:', round(time() - start_time, 4), 'secs. <<<')
        df_local = self.d_preprocess['categorical'].transform(df_local, verbose=verbose)

        return df_local
Apply preprocessing.

        Requires preprocess method to have been applied (so that all encoder are fitted).

        Parameters
        ----------
        df : DataFrame
            dataset to apply preprocessing on
        verbose : boolean (Default False)
            Get logging information

        Returns
        -------
        DataFrame : Preprocessed dataset
        
Apply preprocessing.
Requires preprocess method to have been applied (so that all encoder are fitted).

Parameters

df : DataFrame
dataset to apply preprocessing on
verbose : boolean (Default False)
Get logging information

Returns

DataFrame : Preprocessed dataset
Apply preprocessing . Requires preprocess method to have been applied ( so that all encoder are fitted ) . Parameters df : DataFrame dataset to apply preprocessing on verbose : boolean ( Default False ) Get logging information Returns DataFrame : Preprocessed dataset
def preprocess_apply(self, df, verbose=False):
        if verbose:
            start_time = time()
            print_title1('Apply Preprocessing')
        assert self.is_fitted_preprocessing, "fit first (please)"
        df_local = df.copy()
         Remove features with zero variance / verbatims and identifiers
        if verbose:
            color_print("Remove features (zero variance, verbatims and identifiers")
        if len(self.d_preprocess['remove']) > 0:
            df_local = df_local.drop(self.d_preprocess['remove'], axis=1)
            if verbose:
                print("  >", len(self.d_preprocess['remove']), 'removed features')
        else:
            if verbose:
                print("  > No features to remove")
         Transform date -> time between date and date_ref
        if verbose:
            color_print("Transform date")
        df_local = self.d_preprocess['date'].transform(df_local, verbose=verbose)
         Missing Values
        if verbose:
            color_print('Missing values')
        df_local = self.d_preprocess['NA'].transform(df_local, verbose=verbose)
         replace outliers
        if 'outlier' in list(self.d_preprocess.keys()):
            if verbose:
                color_print('Outliers')
            df_local = self.d_preprocess['outlier'].transform(df_local, verbose=verbose)
         categorical processing
        if verbose:
            color_print('Encode categorical and boolean')
            print('\n\t\t>>>', 'preprocess_apply execution time:', round(time() - start_time, 4), 'secs. <<<')
        df_local = self.d_preprocess['categorical'].transform(df_local, verbose=verbose)
        return df_local
def preprocess_apply ( self , df , verbose = False ) : if verbose : start_time = time ( ) print_title1 ( 'Apply Preprocessing' ) assert self . is_fitted_preprocessing , "fit first (please)" df_local = df . copy ( ) if verbose : color_print ( "Remove features (zero variance, verbatims and identifiers" ) if len ( self . d_preprocess [ 'remove' ] ) > 0 : df_local = df_local . drop ( self . d_preprocess [ 'remove' ] , axis = 1 ) if verbose : print ( "  >" , len ( self . d_preprocess [ 'remove' ] ) , 'removed features' ) else : if verbose : print ( "  > No features to remove" ) if verbose : color_print ( "Transform date" ) df_local = self . d_preprocess [ 'date' ] . transform ( df_local , verbose = verbose ) if verbose : color_print ( 'Missing values' ) df_local = self . d_preprocess [ 'NA' ] . transform ( df_local , verbose = verbose ) if 'outlier' in list ( self . d_preprocess . keys ( ) ) : if verbose : color_print ( 'Outliers' ) df_local = self . d_preprocess [ 'outlier' ] . transform ( df_local , verbose = verbose ) if verbose : color_print ( 'Encode categorical and boolean' ) print ( '\n\t\t>>>' , 'preprocess_apply execution time:' , round ( time ( ) - start_time , 4 ) , 'secs. <<<' ) df_local = self . d_preprocess [ 'categorical' ] . transform ( df_local , verbose = verbose ) return df_local
Apply preprocessing.
Apply preprocessing .
"""Apply preprocessing.

        Requires preprocess method to have been applied (so that all encoder are fitted).

        Parameters
        ----------
        df : DataFrame
            dataset to apply preprocessing on
        verbose : boolean (Default False)
            Get logging information

        Returns
        -------
        DataFrame : Preprocessed dataset
        """ # check pipe step and is_fitted # # Remove features with zero variance / verbatims and identifiers # Transform date -> time between date and date_ref # Missing Values # replace outliers # categorical processing
self
df
verbose