(self, attributes, x, n_vals)
return self.rows_model_type(
            attributes, impute, getattr(self, "normalize", False),
            continuous, discrete,
            offsets[:curr_cont], scales[:curr_cont],
            dist_missing2_cont[:curr_cont],
            dist_missing_disc, dist_missing2_disc,
            self.callback)
Return a DistanceModel for computation of distances between rows.

        The model type is `self.row_distance_model`. It stores the data for
        imputation of discrete and continuous values, and for normalization
        of continuous values. Typical examples are the Euclidean and Manhattan
        distance, for which the following data is stored:

        For continuous columns:

        - offsets[col] is the number subtracted from values in column `col`
        - scales[col] is the divisor for values in columns `col`
        - dist_missing2_cont[col]: the value used for distance between two
            missing values in column `col`

        For discrete values:

        - dist_missing_disc[col, value] is the distance added for the given
            `value` in the column `col` if the value for the other row is
            missing
        - dist_missing2_disc[col]: the distance between two missing values in
            column `col`
Return a DistanceModel for computation of distances between rows.
Return a DistanceModel for computation of distances between rows .
def fit_rows(self, attributes, x, n_vals):
        """
        Return a DistanceModel for computation of distances between rows.

        The model type is `self.row_distance_model`. It stores the data for
        imputation of discrete and continuous values, and for normalization
        of continuous values. Typical examples are the Euclidean and Manhattan
        distance, for which the following data is stored:

        For continuous columns:

        - offsets[col] is the number subtracted from values in column `col`
        - scales[col] is the divisor for values in columns `col`
        - dist_missing2_cont[col]: the value used for distance between two
            missing values in column `col`

        For discrete values:

        - dist_missing_disc[col, value] is the distance added for the given
            `value` in the column `col` if the value for the other row is
            missing
        - dist_missing2_disc[col]: the distance between two missing values in
            column `col`
        """
        n_cols = len(n_vals)

        discrete = n_vals > 0
        n_bins = max(n_vals, default=0)
        n_discrete = sum(discrete)
        dist_missing_disc = np.zeros((n_discrete, n_bins), dtype=float)
        dist_missing2_disc = np.zeros(n_discrete, dtype=float)

        continuous = ~discrete
        n_continuous = sum(continuous)
        offsets = np.zeros(n_continuous, dtype=float)
        scales = np.empty(n_continuous, dtype=float)
        dist_missing2_cont = np.zeros(n_continuous, dtype=float)

        curr_disc = curr_cont = 0
        for col in range(n_cols):
            column = x[:, col]
            if np.isnan(column).all():
                continuous[col] = discrete[col] = False
            elif discrete[col]:
                discrete_stats = self.get_discrete_stats(column, n_bins)
                if discrete_stats is not None:
                    dist_missing_disc[curr_disc], \
                    dist_missing2_disc[curr_disc] = discrete_stats
                    curr_disc += 1
            else:
                continuous_stats = self.get_continuous_stats(column)
                if continuous_stats is not None:
                    offsets[curr_cont], scales[curr_cont],\
                    dist_missing2_cont[curr_cont] = continuous_stats
                    curr_cont += 1
                else:
                    continuous[col] = False
        # pylint: disable=not-callable
        return self.rows_model_type(
            attributes, impute, getattr(self, "normalize", False),
            continuous, discrete,
            offsets[:curr_cont], scales[:curr_cont],
            dist_missing2_cont[:curr_cont],
            dist_missing_disc, dist_missing2_disc,
            self.callback)
def fit_rows ( self , attributes , x , n_vals ) : n_cols = len ( n_vals ) discrete = n_vals > 0 n_bins = max ( n_vals , default = 0 ) n_discrete = sum ( discrete ) dist_missing_disc = np . zeros ( ( n_discrete , n_bins ) , dtype = float ) dist_missing2_disc = np . zeros ( n_discrete , dtype = float ) continuous = ~ discrete n_continuous = sum ( continuous ) offsets = np . zeros ( n_continuous , dtype = float ) scales = np . empty ( n_continuous , dtype = float ) dist_missing2_cont = np . zeros ( n_continuous , dtype = float ) curr_disc = curr_cont = 0 for col in range ( n_cols ) : column = x [ : , col ] if np . isnan ( column ) . all ( ) : continuous [ col ] = discrete [ col ] = False elif discrete [ col ] : discrete_stats = self . get_discrete_stats ( column , n_bins ) if discrete_stats is not None : dist_missing_disc [ curr_disc ] , dist_missing2_disc [ curr_disc ] = discrete_stats curr_disc += 1 else : continuous_stats = self . get_continuous_stats ( column ) if continuous_stats is not None : offsets [ curr_cont ] , scales [ curr_cont ] , dist_missing2_cont [ curr_cont ] = continuous_stats curr_cont += 1 else : continuous [ col ] = False # pylint: disable=not-callable return self . rows_model_type ( attributes , impute , getattr ( self , "normalize" , False ) , continuous , discrete , offsets [ : curr_cont ] , scales [ : curr_cont ] , dist_missing2_cont [ : curr_cont ] , dist_missing_disc , dist_missing2_disc , self . callback )