@@ -723,6 +723,40 @@ method taking no input and returning a boolean. If this method exists,
723
723
See :ref: `sphx_glr_auto_examples_developing_estimators_sklearn_is_fitted.py `
724
724
for an example on how to use the API.
725
725
726
+ Developer API for HTML representation
727
+ =====================================
728
+
729
+ .. warning ::
730
+
731
+ The HTML representation API is experimental and the API is subject to change.
732
+
733
+ Estimators inheriting from :class: `~sklearn.base.BaseEstimator ` display
734
+ a HTML representation of themselves in interactive programming
735
+ environments such as Jupyter notebooks. For instance, we can display this HTML
736
+ diagram::
737
+
738
+ from sklearn.base import BaseEstimator
739
+
740
+ BaseEstimator()
741
+
742
+ The raw HTML representation is obtained by invoking the function
743
+ :func: `~sklearn.utils.estimator_html_repr ` on an estimator instance.
744
+
745
+ To customize the URL linking to an estimator's documentation (i.e. when clicking on the
746
+ "?" icon), override the `_doc_link_module ` and `_doc_link_template ` attributes. In
747
+ addition, you can provide a `_doc_link_url_param_generator ` method. Set
748
+ `_doc_link_module ` to the name of the (top level) module that contains your estimator.
749
+ If the value does not match the top level module name, the HTML representation will not
750
+ contain a link to the documentation. For scikit-learn estimators this is set to
751
+ `"sklearn" `.
752
+
753
+ The `_doc_link_template ` is used to construct the final URL. By default, it can contain
754
+ two variables: `estimator_module ` (the full name of the module containing the estimator)
755
+ and `estimator_name ` (the class name of the estimator). If you need more variables you
756
+ should implement the `_doc_link_url_param_generator ` method which should return a
757
+ dictionary of the variables and their values. This dictionary will be used to render the
758
+ `_doc_link_template `.
759
+
726
760
.. _coding-guidelines :
727
761
728
762
Coding guidelines
0 commit comments