(self, data, replace_method=None, replace_value=None, output_format=consts.ORIGIN,
            col_replace_method=None)
return process_data, cols_transform_value
Apply imputer for input data
        Parameters
        ----------
        data: Table, each data's value should be list
        replace_method: str, the strategy of imputer, like min, max, mean or designated and so on. Default None
        replace_value: str, if replace_method is designated, you should assign the replace_value which will be used to replace the value in imputer_value_list
        output_format: str, the output data format. The output data can be 'str', 'int', 'float'. Default origin, the original format as input data
        col_replace_method: dict of (col_name, replace_method), any col_name not included will take replace_method

        Returns
        ----------
        fit_data:data_instance, data after imputer
        cols_transform_value: list, the replace value in each column
Apply imputer for input data
        Parameters
        ----------
        data: Table, each data's value should be list
        replace_method: str, the strategy of imputer, like min, max, mean or designated and so on. Default None
        replace_value: str, if replace_method is designated, you should assign the replace_value which will be used to replace the value in imputer_value_list
        output_format: str, the output data format. The output data can be 'str', 'int', 'float'. Default origin, the original format as input data
        col_replace_method: dict of (col_name, replace_method), any col_name not included will take replace_method
Apply imputer for input data Parameters ---------- data : Table each data s value should be list replace_method : str the strategy of imputer like min max mean or designated and so on . Default None replace_value : str if replace_method is designated you should assign the replace_value which will be used to replace the value in imputer_value_list output_format : str the output data format . The output data can be str int float . Default origin the original format as input data col_replace_method : dict of ( col_name replace_method ) any col_name not included will take replace_method
def fit(self, data, replace_method=None, replace_value=None, output_format=consts.ORIGIN,
            col_replace_method=None):
        """
        Apply imputer for input data
        Parameters
        ----------
        data: Table, each data's value should be list
        replace_method: str, the strategy of imputer, like min, max, mean or designated and so on. Default None
        replace_value: str, if replace_method is designated, you should assign the replace_value which will be used to replace the value in imputer_value_list
        output_format: str, the output data format. The output data can be 'str', 'int', 'float'. Default origin, the original format as input data
        col_replace_method: dict of (col_name, replace_method), any col_name not included will take replace_method

        Returns
        ----------
        fit_data:data_instance, data after imputer
        cols_transform_value: list, the replace value in each column
        """
        if output_format not in self.support_output_format:
            raise ValueError("Unsupport output_format:{}".format(output_format))

        output_format = self.support_output_format[output_format]

        if isinstance(replace_method, str):
            replace_method = replace_method.lower()
            if replace_method not in self.support_replace_method:
                raise ValueError("Unknown replace method:{}".format(replace_method))
        elif replace_method is None and col_replace_method is None:
            if isinstance(data.first()[1], Instance):
                replace_value = 0
            else:
                replace_value = '0'
        elif replace_method is None and col_replace_method is not None:
            LOGGER.debug(f"perform computation on selected cols only: {col_replace_method}")
        else:
            raise ValueError("parameter replace_method should be str or None only")
        if isinstance(col_replace_method, dict):
            for col_name, method in col_replace_method.items():
                method = method.lower()
                if method not in self.support_replace_method:
                    raise ValueError("Unknown replace method:{}".format(method))
                col_replace_method[col_name] = method

        process_data, cols_transform_value = self.__fit_replace(data, replace_method, replace_value, output_format,
                                                                col_replace_method=col_replace_method)

        self.cols_fit_impute_rate = self.__get_impute_rate_from_replace_data(process_data)
        process_data = process_data.mapValues(lambda v:v[0])
        process_data.schema = data.schema

        return process_data, cols_transform_value
def fit ( self , data , replace_method = None , replace_value = None , output_format = consts . ORIGIN , col_replace_method = None ) : if output_format not in self . support_output_format : raise ValueError ( "Unsupport output_format:{}" . format ( output_format ) ) output_format = self . support_output_format [ output_format ] if isinstance ( replace_method , str ) : replace_method = replace_method . lower ( ) if replace_method not in self . support_replace_method : raise ValueError ( "Unknown replace method:{}" . format ( replace_method ) ) elif replace_method is None and col_replace_method is None : if isinstance ( data . first ( ) [ 1 ] , Instance ) : replace_value = 0 else : replace_value = '0' elif replace_method is None and col_replace_method is not None : LOGGER . debug ( f"perform computation on selected cols only: {col_replace_method}" ) else : raise ValueError ( "parameter replace_method should be str or None only" ) if isinstance ( col_replace_method , dict ) : for col_name , method in col_replace_method . items ( ) : method = method . lower ( ) if method not in self . support_replace_method : raise ValueError ( "Unknown replace method:{}" . format ( method ) ) col_replace_method [ col_name ] = method process_data , cols_transform_value = self . __fit_replace ( data , replace_method , replace_value , output_format , col_replace_method = col_replace_method ) self . cols_fit_impute_rate = self . __get_impute_rate_from_replace_data ( process_data ) process_data = process_data . mapValues ( lambda v : v [ 0 ] ) process_data . schema = data . schema return process_data , cols_transform_value