.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_kernels.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_kernels.py: ===================== Plot kernel functions ===================== This script requires matplotlib .. GENERATED FROM PYTHON SOURCE LINES 8-34 .. image-sg:: /auto_examples/images/sphx_glr_plot_kernels_001.png :alt: uniform, triangular, gaussian, epanechnikov, quartic, triweight, tricube, cosine, exp-4 :srcset: /auto_examples/images/sphx_glr_plot_kernels_001.png :class: sphx-glr-single-img .. code-block:: python3 import matplotlib.pyplot as plt import numpy as np from rlberry_research.agents.kernel_based.kernels import kernel_func kernel_types = [ "uniform", "triangular", "gaussian", "epanechnikov", "quartic", "triweight", "tricube", "cosine", "exp-4", ] z = np.linspace(-2, 2, 100) fig, axes = plt.subplots(1, len(kernel_types), figsize=(15, 5)) for ii, k_type in enumerate(kernel_types): kernel_vals = kernel_func(z, k_type) axes[ii].plot(z, kernel_vals) axes[ii].set_title(k_type) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 6.332 seconds) .. _sphx_glr_download_auto_examples_plot_kernels.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_kernels.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_kernels.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_