.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_ch9\ch9_priceExtrapolation.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_ch9_ch9_priceExtrapolation.py: ==================================================================================================== 9.12 Price extrapolation using KRR and Taylor ==================================================================================================== We reproduce here the figure 9.15 of the book. We show price extrapolation using Kernel Ridge Regression (KRR) and Taylor series. Utilitary functions can be found next to this file. .. GENERATED FROM PYTHON SOURCE LINES 11-13 Necessary Imports ------------------------ .. GENERATED FROM PYTHON SOURCE LINES 13-31 .. code-block:: Python import os import sys from matplotlib import pyplot as plt try: CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) except NameError: CURRENT_DIR = os.getcwd() data_path = os.path.join(CURRENT_DIR, "data") PARENT_DIR = os.path.abspath(os.path.join(CURRENT_DIR, "..")) sys.path.insert(0, PARENT_DIR) from utils.ch9.heston import * params = predict_prices() params["graphic"](params) plt.show() .. image-sg:: /auto_ch9/images/sphx_glr_ch9_priceExtrapolation_001.png :alt: exact-Taylor-codpy :srcset: /auto_ch9/images/sphx_glr_ch9_priceExtrapolation_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.703 seconds) .. _sphx_glr_download_auto_ch9_ch9_priceExtrapolation.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: ch9_priceExtrapolation.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: ch9_priceExtrapolation.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: ch9_priceExtrapolation.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_