|
| 1 | +:orphan: |
| 2 | + |
| 3 | +.. _extensions: |
| 4 | + |
| 5 | +========== |
| 6 | +Extensions |
| 7 | +========== |
| 8 | + |
| 9 | +OpenML-Python provides an extension interface to connect other machine learning libraries than |
| 10 | +scikit-learn to OpenML. Please check the :ref:`api_extensions` and use the |
| 11 | +scikit-learn extension in :class:`openml.extensions.sklearn.SklearnExtension` as a starting point. |
| 12 | + |
| 13 | +List of extensions |
| 14 | +================== |
| 15 | + |
| 16 | +Here is a list of currently maintained OpenML extensions: |
| 17 | + |
| 18 | +* :class:`openml.extensions.sklearn.SklearnExtension` |
| 19 | +* `openml-keras <https://github.com/openml/openml-keras>`_ |
| 20 | +* `openml-pytorch <https://github.com/openml/openml-pytorch>`_ |
| 21 | +* `openml-tensorflow (for tensorflow 2+) <https://github.com/openml/openml-tensorflow>`_ |
| 22 | + |
| 23 | + |
| 24 | +Connecting new machine learning libraries |
| 25 | +========================================= |
| 26 | + |
| 27 | +Content of the Library |
| 28 | +~~~~~~~~~~~~~~~~~~~~~~ |
| 29 | + |
| 30 | +To leverage support from the community and to tap in the potential of OpenML, interfacing |
| 31 | +with popular machine learning libraries is essential. However, the OpenML-Python team does |
| 32 | +not have the capacity to develop and maintain such interfaces on its own. For this, we |
| 33 | +have built an extension interface to allows others to contribute back. Building a suitable |
| 34 | +extension for therefore requires an understanding of the current OpenML-Python support. |
| 35 | + |
| 36 | +The :ref:`sphx_glr_examples_20_basic_simple_flows_and_runs_tutorial.py` tutorial |
| 37 | +shows how scikit-learn currently works with OpenML-Python as an extension. The *sklearn* |
| 38 | +extension packaged with the `openml-python <https://github.com/openml/openml-python>`_ |
| 39 | +repository can be used as a template/benchmark to build the new extension. |
| 40 | + |
| 41 | + |
| 42 | +API |
| 43 | ++++ |
| 44 | +* The extension scripts must import the `openml` package and be able to interface with |
| 45 | + any function from the OpenML-Python :ref:`api`. |
| 46 | +* The extension has to be defined as a Python class and must inherit from |
| 47 | + :class:`openml.extensions.Extension`. |
| 48 | +* This class needs to have all the functions from `class Extension` overloaded as required. |
| 49 | +* The redefined functions should have adequate and appropriate docstrings. The |
| 50 | + `Sklearn Extension API :class:`openml.extensions.sklearn.SklearnExtension.html` |
| 51 | + is a good benchmark to follow. |
| 52 | + |
| 53 | + |
| 54 | +Interfacing with OpenML-Python |
| 55 | +++++++++++++++++++++++++++++++ |
| 56 | +Once the new extension class has been defined, the openml-python module to |
| 57 | +:meth:`openml.extensions.register_extension` must be called to allow OpenML-Python to |
| 58 | +interface the new extension. |
| 59 | + |
| 60 | + |
| 61 | +Hosting the library |
| 62 | +~~~~~~~~~~~~~~~~~~~ |
| 63 | + |
| 64 | +Each extension created should be a stand-alone repository, compatible with the |
| 65 | +`OpenML-Python repository <https://github.com/openml/openml-python>`_. |
| 66 | +The extension repository should work off-the-shelf with *OpenML-Python* installed. |
| 67 | + |
| 68 | +Create a `public Github repo <https://docs.github.com/en/github/getting-started-with-github/create-a-repo>`_ |
| 69 | +with the following directory structure: |
| 70 | + |
| 71 | +:: |
| 72 | + |
| 73 | +| [repo name] |
| 74 | +| |-- [extension name] |
| 75 | +| | |-- __init__.py |
| 76 | +| | |-- extension.py |
| 77 | +| | |-- config.py (optionally) |
| 78 | +
|
| 79 | +Recommended |
| 80 | +~~~~~~~~~~~ |
| 81 | +* Test cases to keep the extension up to date with the `openml-python` upstream changes. |
| 82 | +* Documentation of the extension API, especially if any new functionality added to OpenML-Python's |
| 83 | + extension design. |
| 84 | +* Examples to show how the new extension interfaces and works with OpenML-Python. |
| 85 | +* Create a PR to add the new extension to the OpenML-Python API documentation. |
| 86 | + |
| 87 | +Happy contributing! |
0 commit comments