(self, matrices, discrete_f=None, continuous_f=None,
                       time_f=None, string_f=None, default_val=np.nan)
return np.hstack(results)
Apply functions to appropriate variable types. The default value is
        returned if there is no function defined for specific variable types.
Apply functions to appropriate variable types. The default value is
        returned if there is no function defined for specific variable types.
Apply functions to appropriate variable types . The default value is returned if there is no function defined for specific variable types .
def __compute_stat(self, matrices, discrete_f=None, continuous_f=None,
                       time_f=None, string_f=None, default_val=np.nan):
        """Apply functions to appropriate variable types. The default value is
        returned if there is no function defined for specific variable types.
        """
        if not matrices:
            return np.array([])

        results = []
        for variables, x in matrices:
            result = np.full(len(variables), default_val)

            # While the following caching and checks are messy, the indexing
            # turns out to be a bottleneck for large datasets, so a single
            # indexing operation improves performance
            *idxs, str_idx = self._attr_indices(variables)
            for func, idx in zip((discrete_f, continuous_f, time_f), idxs):
                idx = np.array(idx)
                if func and idx.size:
                    x_ = x[:, idx]
                    if x_.size:
                        if not np.issubdtype(x_.dtype, np.number):
                            x_ = x_.astype(np.float64)
                        try:
                            finites = np.isfinite(x_)
                        except TypeError:
                            result[idx] = func(x_)
                        else:
                            mask = np.any(finites, axis=0)
                            if np.any(mask):
                                result[idx[mask]] = func(x_[:, mask])
            if string_f:
                x_ = x[:, str_idx]
                if x_.size:
                    if x_.dtype is not np.object:
                        x_ = x_.astype(np.object)
                    result[str_idx] = string_f(x_)

            results.append(result)

        return np.hstack(results)
def __compute_stat ( self , matrices , discrete_f = None , continuous_f = None , time_f = None , string_f = None , default_val = np . nan ) : if not matrices : return np . array ( [ ] ) results = [ ] for variables , x in matrices : result = np . full ( len ( variables ) , default_val ) # While the following caching and checks are messy, the indexing # turns out to be a bottleneck for large datasets, so a single # indexing operation improves performance * idxs , str_idx = self . _attr_indices ( variables ) for func , idx in zip ( ( discrete_f , continuous_f , time_f ) , idxs ) : idx = np . array ( idx ) if func and idx . size : x_ = x [ : , idx ] if x_ . size : if not np . issubdtype ( x_ . dtype , np . number ) : x_ = x_ . astype ( np . float64 ) try : finites = np . isfinite ( x_ ) except TypeError : result [ idx ] = func ( x_ ) else : mask = np . any ( finites , axis = 0 ) if np . any ( mask ) : result [ idx [ mask ] ] = func ( x_ [ : , mask ] ) if string_f : x_ = x [ : , str_idx ] if x_ . size : if x_ . dtype is not np . object : x_ = x_ . astype ( np . object ) result [ str_idx ] = string_f ( x_ ) results . append ( result ) return np . hstack ( results )