From 5ca5bb80709ab228096739b9a998587b342905e5 Mon Sep 17 00:00:00 2001 From: Jialue Chen Date: Wed, 9 Oct 2024 19:24:31 -0400 Subject: [PATCH] update docs --- ...hquantlib.calibration.model_calibrator.rst | 47 ++++++++++++++----- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/docs/source/torchquantlib.calibration.model_calibrator.rst b/docs/source/torchquantlib.calibration.model_calibrator.rst index d9432e3..889ddae 100644 --- a/docs/source/torchquantlib.calibration.model_calibrator.rst +++ b/docs/source/torchquantlib.calibration.model_calibrator.rst @@ -1,20 +1,41 @@ -torchquantlib.calibration.model_calibrator -========================================== - -.. automodule:: torchquantlib.calibration.model_calibrator - :members: - :undoc-members: - :show-inheritance: - ModelCalibrator ---------------- +=============== -.. autoclass:: ModelCalibrator +.. autoclass:: torchquantlib.calibration.model_calibrator.ModelCalibrator :members: :undoc-members: :show-inheritance: .. automethod:: __init__ - .. automethod:: _setup_optimizer - .. automethod:: calibrate - .. automethod:: get_calibrated_params + +Class Description +----------------- + +The ``ModelCalibrator`` class is designed to calibrate a stochastic model using the Sinkhorn divergence. It utilizes the geomloss library for calculating the loss. + +Parameters +---------- + +- ``model``: The stochastic model to be calibrated. +- ``observed_data``: The observed market data used for calibration. +- ``S0`` (optional): Initial value. Default is None. +- ``T`` (float): Time horizon. Default is 1.0. +- ``loss_type`` (str): Type of loss function. Default is "sinkhorn". +- ``p`` (int): Power parameter for the loss function. Default is 2. +- ``blur`` (float): Blur parameter for the loss function. Default is 0.05. +- ``optimizer_cls``: Optimizer class. Default is ``torch.optim.Adam``. +- ``lr`` (float): Learning rate for the optimizer. Default is 0.01. + +Methods +------- + +__init__(self, model, observed_data, S0=None, T=1.0, loss_type="sinkhorn", p=2, blur=0.05, optimizer_cls=optim.Adam, lr=0.01) + Initialize the ModelCalibrator with the given parameters. + +calibrate(self, num_epochs=1000, batch_size=None, steps=100, verbose=True) + Perform the calibration process. + +get_calibrated_params(self) + Retrieve the calibrated parameters after calibration. + +