diff --git a/mne/fixes.py b/mne/fixes.py index e60276a3c9b..dcaf8e56c7a 100644 --- a/mne/fixes.py +++ b/mne/fixes.py @@ -325,7 +325,7 @@ def orth(A, rcond=None): # noqa u, s, vh = linalg.svd(A, full_matrices=False) M, N = u.shape[0], vh.shape[1] if rcond is None: - rcond = numpy.finfo(s.dtype).eps * max(M, N) + rcond = np.finfo(s.dtype).eps * max(M, N) tol = np.amax(s) * rcond num = np.sum(s > tol, dtype=int) Q = u[:, :num] @@ -334,6 +334,7 @@ def orth(A, rcond=None): # noqa ############################################################################### # NumPy Generator (NumPy 1.17) + def rng_uniform(rng): """Get the unform/randint from the rng.""" # prefer Generator.integers, fall back to RandomState.randint @@ -577,6 +578,17 @@ def __repr__(self): # conditionals that are not satisfied by our objects (e.g., # ``if type(self).__module__.startswith('sklearn.')``. + def _get_tags(self): + collected_tags = {} + for base_class in reversed(inspect.getmro(self.__class__)): + if hasattr(base_class, '_more_tags'): + # need the if because mixins might not have _more_tags + # but might do redundant work in estimators + # (i.e. calling more tags on BaseEstimator multiple times) + more_tags = base_class._more_tags(self) + collected_tags.update(more_tags) + return collected_tags + # newer sklearn deprecates importing from sklearn.metrics.scoring, # but older sklearn does not expose check_scoring in sklearn.metrics. @@ -1065,6 +1077,7 @@ def _make_along_axis_idx(arr_shape, indices, axis): ############################################################################### # From nilearn + def _crop_colorbar(cbar, cbar_vmin, cbar_vmax): """ crop a colorbar to show from cbar_vmin to cbar_vmax