Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions openml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,3 @@ def populate_cache(
"_api_calls",
"__version__",
]

# Load the scikit-learn extension by default
# TODO(eddiebergman): Not sure why this is at the bottom of the file
import openml.extensions.sklearn # noqa: E402, F401
22 changes: 20 additions & 2 deletions openml/extensions/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@

from . import Extension

SKLEARN_HINT = (
"But it looks related to scikit-learn. "
"Please install the OpenML scikit-learn extension (openml-sklearn) and try again. "
"For more information, see "
"https://github.com/openml/openml-sklearn?tab=readme-ov-file#installation"
)


def register_extension(extension: type[Extension]) -> None:
"""Register an extension.
Expand Down Expand Up @@ -57,7 +64,13 @@ def get_extension_by_flow(
candidates.append(extension_class())
if len(candidates) == 0:
if raise_if_no_extension:
raise ValueError(f"No extension registered which can handle flow: {flow}")
install_instruction = ""
if flow.name.startswith("sklearn"):
install_instruction = SKLEARN_HINT
raise ValueError(
f"No extension registered which can handle flow: {flow.flow_id} ({flow.name}). "
f"{install_instruction}"
)

return None

Expand Down Expand Up @@ -96,7 +109,12 @@ def get_extension_by_model(
candidates.append(extension_class())
if len(candidates) == 0:
if raise_if_no_extension:
raise ValueError(f"No extension registered which can handle model: {model}")
install_instruction = ""
if type(model).__module__.startswith("sklearn"):
install_instruction = SKLEARN_HINT
raise ValueError(
f"No extension registered which can handle model: {model}. {install_instruction}"
)

return None

Expand Down
43 changes: 0 additions & 43 deletions openml/extensions/sklearn/__init__.py

This file was deleted.

Loading