Skip to content
Open
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
12 changes: 10 additions & 2 deletions openml/extensions/functions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# License: BSD 3-Clause
from __future__ import annotations

import importlib.util
from typing import TYPE_CHECKING, Any

# Need to implement the following by its full path because otherwise it won't be possible to
Expand All @@ -16,8 +17,7 @@
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"
"You can use `pip install openml-sklearn` for installation."
)


Expand Down Expand Up @@ -58,6 +58,10 @@ def get_extension_by_flow(
-------
Extension or None
"""
# import openml_sklearn to register SklearnExtension
if importlib.util.find_spec("openml_sklearn"):
import openml_sklearn # noqa: F401

candidates = []
for extension_class in openml.extensions.extensions:
if extension_class.can_handle_flow(flow):
Expand Down Expand Up @@ -103,6 +107,10 @@ def get_extension_by_model(
-------
Extension or None
"""
# import openml_sklearn to register SklearnExtension
if importlib.util.find_spec("openml_sklearn"):
import openml_sklearn # noqa: F401

candidates = []
for extension_class in openml.extensions.extensions:
if extension_class.can_handle_model(model):
Expand Down