Skip to content

DOC take Examples out of a dropdown #27034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 11, 2023
Merged
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
24 changes: 14 additions & 10 deletions doc/modules/svm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,8 @@ is advised to use :class:`~sklearn.model_selection.GridSearchCV` with
* :ref:`sphx_glr_auto_examples_svm_plot_rbf_parameters.py`
* :ref:`sphx_glr_auto_examples_svm_plot_svm_nonlinear.py`

|details-start|
**Custom Kernels**
|details-split|
Custom Kernels
--------------

You can define your own kernels by either giving the kernel as a
python function or by precomputing the Gram matrix.
Expand All @@ -539,8 +538,9 @@ classifiers, except that:
use of ``fit()`` and ``predict()`` you will have unexpected results.


Using Python functions as kernels
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|details-start|
**Using Python functions as kernels**
|details-split|

You can use your own defined kernels by passing a function to the
``kernel`` parameter.
Expand All @@ -558,13 +558,13 @@ instance that will use that kernel::
... return np.dot(X, Y.T)
...
>>> clf = svm.SVC(kernel=my_kernel)

|details-end|

.. topic:: Examples:

* :ref:`sphx_glr_auto_examples_svm_plot_custom_kernel.py`.

Using the Gram matrix
~~~~~~~~~~~~~~~~~~~~~
|details-start|
**Using the Gram matrix**
|details-split|

You can pass pre-computed kernels by using the ``kernel='precomputed'``
option. You should then pass Gram matrix instead of X to the `fit` and
Expand All @@ -589,6 +589,10 @@ test vectors must be provided:

|details-end|

.. topic:: Examples:

* :ref:`sphx_glr_auto_examples_svm_plot_custom_kernel.py`.

.. _svm_mathematical_formulation:

Mathematical formulation
Expand Down