MCPcopy
hub / github.com/mne-tools/mne-python / _check_method

Function _check_method

mne/decoding/search_light.py:468–478  ·  view source on GitHub ↗

Check that an estimator has the method attribute. If method == 'transform' and estimator does not have 'transform', use 'predict' instead.

(estimator, method)

Source from the content-addressed store, hash-verified

466
467
468def _check_method(estimator, method):
469 """Check that an estimator has the method attribute.
470
471 If method == 'transform' and estimator does not have 'transform', use
472 'predict' instead.
473 """
474 if method == "transform" and not hasattr(estimator, "transform"):
475 method = "predict"
476 if not hasattr(estimator, method):
477 ValueError(f"base_estimator does not have `{method}` method.")
478 return method
479
480
481@fill_doc

Callers 2

_transformMethod · 0.70
_transformMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected