-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e1298f1
commit 5ca5bb8
Showing
1 changed file
with
34 additions
and
13 deletions.
There are no files selected for viewing
47 changes: 34 additions & 13 deletions
47
docs/source/torchquantlib.calibration.model_calibrator.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
|
||
|