Github user njayaram2 commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/260#discussion_r180604708
  
    --- Diff: 
src/ports/postgres/modules/utilities/minibatch_preprocessing.py_in ---
    @@ -387,6 +397,7 @@ class MiniBatchStandardizer:
             ) as {ind_colname}
             FROM {source_table}
             """.format(
    +            standardized_table = self.standardized_table,
    --- End diff --
    
    I think the following also works (using `self` inside format), and looks 
neater:
    ```
    query="""
            CREATE TEMP TABLE {self.standardized_table} as
            SELECT
            {self.dep_var_array_str} as {dep_colname},
            {self.schema_madlib}.utils_normalize_data
            (
                {self.indep_var_array_str},'{self.x_mean_str}'::double 
precision[],
                '{self.x_std_dev_str}'::double precision[]
            ) as {ind_colname}
            FROM {self.source_table}
            """.format(self=self,
                       dep_colname = MINIBATCH_OUTPUT_DEPENDENT_COLNAME,
                       ind_colname = MINIBATCH_OUTPUT_INDEPENDENT_COLNAME)
    ```
    This could be applied in several other queries too in this file.


---

Reply via email to