quantdata.dysanos.implied.pca#

Validated centered PCA of log implied-volatility surface levels.

class quantdata.dysanos.implied.pca.LogIVPCA(*, mean_log_iv, components, explained_variance, explained_variance_ratio, cumulative_explained_variance_ratio, expiries, nms)[source]#

Bases: object

Centered, unweighted PCA representation of log-IV surface levels.

property num_components: int#
property surface_shape: tuple[int, int]#
encode(implied_vols)[source]#

Encode positive IV surfaces whose trailing axes are (T,N).

decode_log_iv(scores)[source]#

Decode PCA scores to log-IV surfaces on the training grid.

decode(scores)[source]#

Decode PCA scores to strictly positive IV grid surfaces.

to_state_dict()[source]#

Return a cache-safe array tree.

classmethod from_state_dict(state)[source]#
class quantdata.dysanos.implied.pca.PCAFitDiagnostics(*, scores, reconstruction, errors_by_expiry, errors_by_nms_region, first_five_iv_eigensurfaces)[source]#

Bases: object

Reconstruction and eigensurface diagnostics for one PCA fit.

report(model)[source]#
class quantdata.dysanos.implied.pca.ValidatedPCAMarket(*, dates, time_y, mid_vols, nms, expiries, xstrikes, spot_ref, spot_ret)[source]#

Bases: object

Arrays required to fit and simulate the direct PCA benchmark.

property shape: tuple[int, int, int]#
quantdata.dysanos.implied.pca.fit_log_iv_pca(implied_vols, *, expiries, nms, num_components=20)[source]#

Fit ordinary centered, unweighted PCA to log-IV surface levels.

quantdata.dysanos.implied.pca.validate_pca_market(market)[source]#

Validate the exact historical-grid inputs used by the PCA benchmark.