Skip to content

Commit

Permalink
fixes for new sklearn (#8373)
Browse files Browse the repository at this point in the history
  • Loading branch information
agramfort authored Oct 15, 2020
1 parent 092a126 commit db510cc
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion mne/fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit db510cc

Please sign in to comment.