(self, data)
return fit_data
Apply standard scale for input data
         Parameters
         ----------
         data: data_instance, input data

         Returns
         ----------
         data:data_instance, data after scale
         mean: list, each column mean value
         std: list, each column standard deviation
Apply standard scale for input data
         Parameters
         ----------
         data: data_instance, input data
Apply standard scale for input data Parameters ---------- data : data_instance input data
def fit(self, data):
        """
         Apply standard scale for input data
         Parameters
         ----------
         data: data_instance, input data

         Returns
         ----------
         data:data_instance, data after scale
         mean: list, each column mean value
         std: list, each column standard deviation
         """
        self.column_min_value, self.column_max_value = self._get_min_max_value(data)
        self.scale_column_idx = self._get_scale_column_idx(data)
        self.header = self._get_header(data)
        self.data_shape = self._get_data_shape(data)

        # fit column value if larger than parameter upper or less than parameter lower
        data = self.fit_feature_range(data)

        if not self.with_mean and not self.with_std:
            self.mean = [0 for _ in range(self.data_shape)]
            self.std = [1 for _ in range(self.data_shape)]
        else:
            self.summary_obj = MultivariateStatisticalSummary(data, -1)

            if self.with_mean:
                self.mean = self.summary_obj.get_mean()
                self.mean = [self.mean[key] for key in self.header]
            else:
                self.mean = [0 for _ in range(self.data_shape)]

            if self.with_std:
                self.std = self.summary_obj.get_std_variance()
                self.std = [self.std[key] for key in self.header]

                for i, value in enumerate(self.std):
                    if np.abs(value - 0) < 1e-6:
                        self.std[i] = 1
            else:
                self.std = [1 for _ in range(self.data_shape)]

        f = functools.partial(self.__scale, mean=self.mean, std=self.std, process_cols_list=self.scale_column_idx)
        fit_data = data.mapValues(f)

        return fit_data
def fit ( self , data ) : self . column_min_value , self . column_max_value = self . _get_min_max_value ( data ) self . scale_column_idx = self . _get_scale_column_idx ( data ) self . header = self . _get_header ( data ) self . data_shape = self . _get_data_shape ( data ) # fit column value if larger than parameter upper or less than parameter lower data = self . fit_feature_range ( data ) if not self . with_mean and not self . with_std : self . mean = [ 0 for _ in range ( self . data_shape ) ] self . std = [ 1 for _ in range ( self . data_shape ) ] else : self . summary_obj = MultivariateStatisticalSummary ( data , - 1 ) if self . with_mean : self . mean = self . summary_obj . get_mean ( ) self . mean = [ self . mean [ key ] for key in self . header ] else : self . mean = [ 0 for _ in range ( self . data_shape ) ] if self . with_std : self . std = self . summary_obj . get_std_variance ( ) self . std = [ self . std [ key ] for key in self . header ] for i , value in enumerate ( self . std ) : if np . abs ( value - 0 ) < 1e-6 : self . std [ i ] = 1 else : self . std = [ 1 for _ in range ( self . data_shape ) ] f = functools . partial ( self . __scale , mean = self . mean , std = self . std , process_cols_list = self . scale_column_idx ) fit_data = data . mapValues ( f ) return fit_data