def fit_x(self, x): """Create the list of columns to be kept for x. Args: :param x: a Pandas Dataframe of shape [n_samples, n_features] the dataset Return: :param self: """ self.x_cols = _check_cols(x, self.x_cols, self.logging) self.logging('x_cols: {}'.format(self.x_cols), level=logging.DEBUG) return self
def fit_y(self, y): """Create the list of columns to be kept for y. Args: :param y: a Pandas Dataframe of shape [n_samples] the target Return: :param self: """ self.y_cols = _check_cols(y, self.y_cols, self.logging) self.logging('y_cols: {}'.format(self.y_cols), level=logging.DEBUG) return self
def fit_x(self, x): """Create the list of columns to be converted for `x` and related mappings. Args: :param x: a Pandas Dataframe of shape [n_samples, n_features] the dataset Return: :param self: """ self.x_cols = _check_cols(x, self.x_cols, self.logging) self.logging('x_cols: {}'.format(self.x_cols), level=logging.DEBUG) self._map_category_to_number['x'], self._map_number_to_category[ 'x'] = self._fit(x, self.x_cols) return self
def fit_y(self, y): """Create the list of columns to be converted for `y` and related mappings. Args: :param y: a Pandas Dataframe of shape [n_samples] the target Return: :param self: """ self.y_cols = _check_cols(y, self.y_cols, self.logging) self.logging('y_cols: {}'.format(self.y_cols), level=logging.DEBUG) self._map_category_to_number['y'], self._map_number_to_category[ 'y'] = self._fit(y, self.y_cols) return self
def fit_y(self, y): self.y_cols = _check_cols(y, self.y_cols, self.logging) self.logging('y_cols: {}'.format(self.y_cols), level=logging.DEBUG) if not self.y_is_categorical or len(self.y_is_categorical) != len( self.y_cols): self.y_is_categorical = _is_categorical_cols(y, self.y_cols) categorical_cols = [ self.y_cols[i] for i, v in enumerate(self.y_is_categorical) if v ] self._cat2num['y'] = Category2Number(x_cols=categorical_cols, skipna=True) # yes, it is x_col self._knn_models['y'] = self._fit(y, self.y_cols, self.y_is_categorical, self._cat2num['y']) return self
def fit_y(self, y): self.y_cols = _check_cols(y, self.y_cols, self.logging) self.logging('y_cols: {}'.format(self.y_cols), level=logging.DEBUG) self.logging('fitting y', level=logging.DEBUG) self._fit(y, self.y_cols, self._pdfs['y']) return self
def fit_x(self, x): self.x_cols = _check_cols(x, self.x_cols, self.logging) self.logging('x_cols: {}'.format(self.x_cols), level=logging.DEBUG) self.logging('fitting x', level=logging.DEBUG) self._fit(x, self.x_cols, self._pdfs['x']) return self
def fit_y(self, y): self.y_cols = _check_cols(y, self.y_cols, self.logging) self.logging('y_cols: {}'.format(self.y_cols), level=logging.DEBUG) return self
def fit_x(self, x): self.x_cols = _check_cols(x, self.x_cols, self.logging) self.logging('x_cols: {}'.format(self.x_cols), level=logging.DEBUG) return self
def fit_y(self, y): Combiner._check_signature(self, self.y_cols) self.y_cols = _check_cols(y, self.y_cols, self.logging) return self
def fit_x(self, x): Combiner._check_signature(self, self.x_cols) self.x_cols = _check_cols(x, self.x_cols, self.logging) return self