dfm-python 0.5.52__tar.gz → 0.5.54__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dfm_python-0.5.54/PKG-INFO +380 -0
- dfm_python-0.5.54/README.md +322 -0
- dfm_python-0.5.54/config/ddfm_finance.yaml +35 -0
- dfm_python-0.5.54/config/ddfm_macro.yaml +63 -0
- dfm_python-0.5.54/config/dfm_finance.yaml +103 -0
- dfm_python-0.5.54/config/dfm_macro.yaml +84 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_10/checkpoints/ddfm-epoch=00-train_loss=0.6495.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_10/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_11/checkpoints/ddfm-epoch=00-train_loss=0.8428.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_11/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_12/checkpoints/ddfm-epoch=00-train_loss=0.8959.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_12/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_13/checkpoints/ddfm-epoch=00-train_loss=0.7644.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_13/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_14/checkpoints/ddfm-epoch=00-train_loss=0.7935.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_14/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_15/checkpoints/ddfm-epoch=00-train_loss=0.6240.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_15/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_16/checkpoints/ddfm-epoch=00-train_loss=0.9689.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_16/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_17/checkpoints/ddfm-epoch=00-train_loss=0.9336.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_17/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_18/checkpoints/ddfm-epoch=00-train_loss=0.8481.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_18/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_19/checkpoints/ddfm-epoch=00-train_loss=0.6991.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_19/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_20/checkpoints/ddfm-epoch=00-train_loss=0.9289.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_20/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_21/checkpoints/ddfm-epoch=00-train_loss=0.8253.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_21/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_22/checkpoints/ddfm-epoch=00-train_loss=0.8933.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_22/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_5/checkpoints/ddfm-epoch=00-train_loss=0.8292.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_5/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_7/checkpoints/ddfm-epoch=00-train_loss=0.8216.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_7/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_8/checkpoints/ddfm-epoch=00-train_loss=0.6088.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_8/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_9/checkpoints/ddfm-epoch=00-train_loss=0.6595.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/ddfm/version_9/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_0/checkpoints/kdfm-epoch=01-train_loss=9750156656246784.0000.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_0/metrics.csv +3 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_1/checkpoints/kdfm-epoch=00-train_loss=inf.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_1/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_10/checkpoints/kdfm-epoch=01-train_loss=0.2948.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_10/metrics.csv +3 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_11/checkpoints/kdfm-epoch=01-train_loss=0.2337.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_11/metrics.csv +3 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_12/checkpoints/kdfm-epoch=01-train_loss=0.2372.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_12/metrics.csv +3 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_13/checkpoints/kdfm-epoch=01-train_loss=0.3323.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_13/metrics.csv +3 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_14/checkpoints/kdfm-epoch=01-train_loss=0.0895.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_14/metrics.csv +3 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_2/checkpoints/kdfm-epoch=00-train_loss=11076925440424673280.0000.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_2/metrics.csv +3 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_3/checkpoints/kdfm-epoch=01-train_loss=3466010845203398656.0000.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_3/metrics.csv +3 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_4/checkpoints/kdfm-epoch=01-train_loss=89213903044608.0000.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_4/metrics.csv +3 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_5/checkpoints/kdfm-epoch=01-train_loss=1842788085222342656.0000.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_5/metrics.csv +3 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_6/checkpoints/kdfm-epoch=00-train_loss=28594968117244854272.0000.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_6/metrics.csv +3 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_7/checkpoints/kdfm-epoch=00-train_loss=inf.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_7/metrics.csv +2 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_8/checkpoints/kdfm-epoch=01-train_loss=457264.4062.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_8/metrics.csv +3 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_9/checkpoints/kdfm-epoch=01-train_loss=0.3095.ckpt +0 -0
- dfm_python-0.5.54/lightning_logs/trainer/version_9/metrics.csv +3 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/pyproject.toml +5 -3
- {dfm_python-0.5.52 → dfm_python-0.5.54}/src/dfm_python/__init__.py +30 -26
- dfm_python-0.5.54/src/dfm_python/config/__init__.py +176 -0
- dfm_python-0.5.54/src/dfm_python/config/adapter.py +507 -0
- dfm_python-0.5.54/src/dfm_python/config/constants.py +448 -0
- dfm_python-0.5.54/src/dfm_python/config/schema/__init__.py +17 -0
- dfm_python-0.5.54/src/dfm_python/config/schema/block.py +64 -0
- dfm_python-0.5.54/src/dfm_python/config/schema/model.py +620 -0
- dfm_python-0.5.54/src/dfm_python/config/schema/results.py +397 -0
- dfm_python-0.5.54/src/dfm_python/config/types.py +314 -0
- dfm_python-0.5.54/src/dfm_python/datamodule/__init__.py +31 -0
- dfm_python-0.5.54/src/dfm_python/datamodule/base.py +618 -0
- dfm_python-0.5.54/src/dfm_python/datamodule/ddfm_dm.py +276 -0
- dfm_python-0.5.54/src/dfm_python/datamodule/dfm_dm.py +313 -0
- dfm_python-0.5.54/src/dfm_python/datamodule/kdfm_dm.py +180 -0
- dfm_python-0.5.54/src/dfm_python/dataset/__init__.py +60 -0
- {dfm_python-0.5.52/src/dfm_python/data → dfm_python-0.5.54/src/dfm_python/dataset}/dataloader.py +49 -47
- {dfm_python-0.5.52/src/dfm_python/data → dfm_python-0.5.54/src/dfm_python/dataset}/dataset.py +70 -66
- dfm_python-0.5.54/src/dfm_python/dataset/process.py +435 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/src/dfm_python/decoder/mlp.py +12 -5
- {dfm_python-0.5.52 → dfm_python-0.5.54}/src/dfm_python/encoder/__init__.py +1 -3
- dfm_python-0.5.54/src/dfm_python/encoder/pca.py +217 -0
- dfm_python-0.5.52/src/dfm_python/encoder/autoencoder.py → dfm_python-0.5.54/src/dfm_python/encoder/simple_encoder.py +81 -37
- dfm_python-0.5.54/src/dfm_python/functional/__init__.py +13 -0
- dfm_python-0.5.54/src/dfm_python/functional/dfm_block.py +419 -0
- dfm_python-0.5.54/src/dfm_python/functional/em.py +958 -0
- dfm_python-0.5.54/src/dfm_python/functional/irf.py +305 -0
- dfm_python-0.5.54/src/dfm_python/functional/krylov.py +124 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/src/dfm_python/logger/inference_logger.py +4 -5
- {dfm_python-0.5.52 → dfm_python-0.5.54}/src/dfm_python/models/__init__.py +9 -3
- dfm_python-0.5.54/src/dfm_python/models/base.py +594 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/src/dfm_python/models/ddfm.py +594 -496
- dfm_python-0.5.54/src/dfm_python/models/dfm.py +1384 -0
- dfm_python-0.5.54/src/dfm_python/models/kdfm.py +1855 -0
- dfm_python-0.5.54/src/dfm_python/numeric/builder.py +191 -0
- dfm_python-0.5.54/src/dfm_python/numeric/estimator.py +849 -0
- dfm_python-0.5.54/src/dfm_python/numeric/stability.py +1239 -0
- dfm_python-0.5.54/src/dfm_python/numeric/tent.py +296 -0
- dfm_python-0.5.54/src/dfm_python/numeric/validator.py +699 -0
- dfm_python-0.5.54/src/dfm_python/ssm/__init__.py +19 -0
- dfm_python-0.5.54/src/dfm_python/ssm/companion.py +995 -0
- dfm_python-0.5.54/src/dfm_python/ssm/kalman.py +432 -0
- dfm_python-0.5.54/src/dfm_python/ssm/structural.py +298 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/src/dfm_python/trainer/__init__.py +17 -86
- dfm_python-0.5.52/src/dfm_python/trainer/denoising.py → dfm_python-0.5.54/src/dfm_python/trainer/ddfm.py +278 -112
- {dfm_python-0.5.52 → dfm_python-0.5.54}/src/dfm_python/trainer/dfm.py +10 -9
- dfm_python-0.5.54/src/dfm_python/trainer/kdfm.py +138 -0
- dfm_python-0.5.54/src/dfm_python/utils/__init__.py +301 -0
- dfm_python-0.5.54/src/dfm_python/utils/common.py +298 -0
- dfm_python-0.5.54/src/dfm_python/utils/errors.py +73 -0
- dfm_python-0.5.54/src/dfm_python/utils/helper.py +200 -0
- dfm_python-0.5.54/src/dfm_python/utils/metric.py +455 -0
- dfm_python-0.5.54/src/dfm_python/utils/misc.py +269 -0
- dfm_python-0.5.54/src/dfm_python/utils/tensor_utils.py +199 -0
- dfm_python-0.5.54/src/dfm_python/utils/validation.py +121 -0
- dfm_python-0.5.54/src/test/__init__.py +8 -0
- dfm_python-0.5.54/src/test/config/__init__.py +2 -0
- dfm_python-0.5.54/src/test/config/schema/__init__.py +2 -0
- dfm_python-0.5.54/src/test/config/schema/test_block.py +26 -0
- dfm_python-0.5.54/src/test/config/schema/test_model.py +22 -0
- dfm_python-0.5.54/src/test/config/schema/test_results.py +193 -0
- dfm_python-0.5.54/src/test/config/test_adapter.py +90 -0
- dfm_python-0.5.54/src/test/config/test_constants.py +158 -0
- dfm_python-0.5.54/src/test/config/test_types.py +56 -0
- dfm_python-0.5.54/src/test/conftest.py +59 -0
- dfm_python-0.5.54/src/test/datamodule/__init__.py +2 -0
- dfm_python-0.5.54/src/test/datamodule/test_base.py +109 -0
- dfm_python-0.5.54/src/test/datamodule/test_ddfm_dm.py +27 -0
- dfm_python-0.5.54/src/test/datamodule/test_dfm_dm.py +26 -0
- dfm_python-0.5.54/src/test/datamodule/test_kdfm_dm.py +27 -0
- dfm_python-0.5.54/src/test/dataset/__init__.py +2 -0
- dfm_python-0.5.54/src/test/dataset/test_dataloader.py +20 -0
- dfm_python-0.5.54/src/test/dataset/test_dataset.py +53 -0
- dfm_python-0.5.54/src/test/dataset/test_process.py +112 -0
- dfm_python-0.5.54/src/test/decoder/__init__.py +2 -0
- dfm_python-0.5.54/src/test/decoder/test_linear.py +40 -0
- dfm_python-0.5.54/src/test/decoder/test_mlp.py +29 -0
- dfm_python-0.5.54/src/test/encoder/__init__.py +2 -0
- dfm_python-0.5.54/src/test/encoder/test_base.py +44 -0
- dfm_python-0.5.54/src/test/encoder/test_pca.py +100 -0
- dfm_python-0.5.54/src/test/encoder/test_simple_encoder.py +207 -0
- dfm_python-0.5.54/src/test/encoder/test_variational_encoder.py +27 -0
- dfm_python-0.5.54/src/test/functional/__init__.py +2 -0
- dfm_python-0.5.54/src/test/functional/test_dfm_block.py +222 -0
- dfm_python-0.5.54/src/test/functional/test_em.py +57 -0
- dfm_python-0.5.54/src/test/functional/test_irf.py +132 -0
- dfm_python-0.5.54/src/test/functional/test_krylov.py +39 -0
- dfm_python-0.5.54/src/test/logger/__init__.py +2 -0
- dfm_python-0.5.54/src/test/logger/test_inference_logger.py +18 -0
- dfm_python-0.5.54/src/test/logger/test_logger.py +28 -0
- dfm_python-0.5.54/src/test/logger/test_train_logger.py +18 -0
- dfm_python-0.5.54/src/test/models/__init__.py +2 -0
- dfm_python-0.5.54/src/test/models/test_base.py +384 -0
- dfm_python-0.5.54/src/test/models/test_ddfm.py +232 -0
- dfm_python-0.5.54/src/test/models/test_dfm.py +147 -0
- dfm_python-0.5.54/src/test/models/test_kdfm.py +411 -0
- dfm_python-0.5.54/src/test/numeric/__init__.py +2 -0
- dfm_python-0.5.54/src/test/numeric/test_builder.py +26 -0
- dfm_python-0.5.54/src/test/numeric/test_estimator.py +65 -0
- dfm_python-0.5.54/src/test/numeric/test_stability.py +392 -0
- dfm_python-0.5.54/src/test/numeric/test_tent.py +69 -0
- dfm_python-0.5.54/src/test/numeric/test_validator.py +279 -0
- dfm_python-0.5.54/src/test/ssm/__init__.py +2 -0
- dfm_python-0.5.54/src/test/ssm/test_arma.py +22 -0
- dfm_python-0.5.54/src/test/ssm/test_companion.py +103 -0
- dfm_python-0.5.54/src/test/ssm/test_kalman.py +116 -0
- dfm_python-0.5.54/src/test/ssm/test_structural.py +67 -0
- dfm_python-0.5.54/src/test/trainer/__init__.py +2 -0
- dfm_python-0.5.54/src/test/trainer/test_ddfm.py +34 -0
- dfm_python-0.5.54/src/test/trainer/test_dfm.py +39 -0
- dfm_python-0.5.54/src/test/trainer/test_kdfm.py +39 -0
- dfm_python-0.5.54/src/test/utils/__init__.py +2 -0
- dfm_python-0.5.54/src/test/utils/test_common.py +321 -0
- dfm_python-0.5.54/src/test/utils/test_errors.py +43 -0
- dfm_python-0.5.54/src/test/utils/test_helper.py +195 -0
- dfm_python-0.5.54/src/test/utils/test_metric.py +32 -0
- dfm_python-0.5.54/src/test/utils/test_misc.py +74 -0
- dfm_python-0.5.54/src/test/utils/test_tensor_utils.py +175 -0
- dfm_python-0.5.54/src/test/utils/test_validation.py +137 -0
- dfm_python-0.5.54/tutorial/tutorial_finance_ddfm.py +259 -0
- dfm_python-0.5.54/tutorial/tutorial_finance_dfm.py +260 -0
- dfm_python-0.5.54/tutorial/tutorial_finance_kdfm.py +285 -0
- dfm_python-0.5.54/tutorial/tutorial_macro_ddfm.py +285 -0
- dfm_python-0.5.54/tutorial/tutorial_macro_dfm.py +306 -0
- dfm_python-0.5.54/tutorial/tutorial_macro_kdfm.py +310 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/uv.lock +30 -1
- dfm_python-0.5.52/PKG-INFO +0 -510
- dfm_python-0.5.52/README.md +0 -455
- dfm_python-0.5.52/config/model/ddfm.yaml +0 -49
- dfm_python-0.5.52/config/model/dfm.yaml +0 -41
- dfm_python-0.5.52/config/series/KO3YEARC.yaml +0 -15
- dfm_python-0.5.52/config/series/KOBFDSAAF.yaml +0 -14
- dfm_python-0.5.52/config/series/KOBFINAAF.yaml +0 -15
- dfm_python-0.5.52/config/series/KOBFXSAAF.yaml +0 -15
- dfm_python-0.5.52/config/series/KOBSESI_R.yaml +0 -14
- dfm_python-0.5.52/config/series/KOBSIBCEQ.yaml +0 -14
- dfm_python-0.5.52/config/series/KOBSIBCOQ.yaml +0 -14
- dfm_python-0.5.52/config/series/KOBSIBNER.yaml +0 -14
- dfm_python-0.5.52/config/series/KOBSIBNMR.yaml +0 -14
- dfm_python-0.5.52/config/series/KOBSIEMAR.yaml +0 -15
- dfm_python-0.5.52/config/series/KOBSIHAPR.yaml +0 -15
- dfm_python-0.5.52/config/series/KOBSIIMER.yaml +0 -15
- dfm_python-0.5.52/config/series/KOBSIIMPR.yaml +0 -15
- dfm_python-0.5.52/config/series/KOBSIXMER.yaml +0 -15
- dfm_python-0.5.52/config/series/KOBUSINVR.yaml +0 -15
- dfm_python-0.5.52/config/series/KOCALL_.yaml +0 -14
- dfm_python-0.5.52/config/series/KOCNFBUSR.yaml +0 -14
- dfm_python-0.5.52/config/series/KOCNFCONR.yaml +0 -15
- dfm_python-0.5.52/config/series/KOCNGOV_D.yaml +0 -14
- dfm_python-0.5.52/config/series/KOCNPER_D.yaml +0 -15
- dfm_python-0.5.52/config/series/KOCOBUSIR.yaml +0 -14
- dfm_python-0.5.52/config/series/KOCONPMTH.yaml +0 -15
- dfm_python-0.5.52/config/series/KOCONPRCF.yaml +0 -15
- dfm_python-0.5.52/config/series/KOCONSTRP.yaml +0 -15
- dfm_python-0.5.52/config/series/KOCPCOREF.yaml +0 -15
- dfm_python-0.5.52/config/series/KOCPEXFEF.yaml +0 -15
- dfm_python-0.5.52/config/series/KOCREU__A.yaml +0 -16
- dfm_python-0.5.52/config/series/KOCSECDMR.yaml +0 -15
- dfm_python-0.5.52/config/series/KOCSECEMR.yaml +0 -15
- dfm_python-0.5.52/config/series/KOCSEMEMR.yaml +0 -16
- dfm_python-0.5.52/config/series/KOCSEOHDR.yaml +0 -15
- dfm_python-0.5.52/config/series/KOCSEOHSR.yaml +0 -15
- dfm_python-0.5.52/config/series/KOCSHHEMR.yaml +0 -15
- dfm_python-0.5.52/config/series/KOCSHHLMR.yaml +0 -15
- dfm_python-0.5.52/config/series/KOCSMTTOA.yaml +0 -16
- dfm_python-0.5.52/config/series/KOCSPHIMR.yaml +0 -15
- dfm_python-0.5.52/config/series/KOCSPSPMR.yaml +0 -15
- dfm_python-0.5.52/config/series/KOCYLEADR.yaml +0 -14
- dfm_python-0.5.52/config/series/KODBLNEQA.yaml +0 -16
- dfm_python-0.5.52/config/series/KODBLNHSA.yaml +0 -16
- dfm_python-0.5.52/config/series/KOEMPCONF.yaml +0 -16
- dfm_python-0.5.52/config/series/KOEMPMANF.yaml +0 -15
- dfm_python-0.5.52/config/series/KOEMPTOTO.yaml +0 -15
- dfm_python-0.5.52/config/series/KOEMPWREP.yaml +0 -16
- dfm_python-0.5.52/config/series/KOEQUIMAE.yaml +0 -15
- dfm_python-0.5.52/config/series/KOEQUIPTE.yaml +0 -15
- dfm_python-0.5.52/config/series/KOEQUITTE.yaml +0 -15
- dfm_python-0.5.52/config/series/KOEXCHINA.yaml +0 -16
- dfm_python-0.5.52/config/series/KOEXNGS_D.yaml +0 -15
- dfm_python-0.5.52/config/series/KOEXPGDSA.yaml +0 -16
- dfm_python-0.5.52/config/series/KOEXPPRCF.yaml +0 -15
- dfm_python-0.5.52/config/series/KOGCFCNSD.yaml +0 -15
- dfm_python-0.5.52/config/series/KOGCFFNVD.yaml +0 -15
- dfm_python-0.5.52/config/series/KOGDP___D.yaml +0 -14
- dfm_python-0.5.52/config/series/KOGFCF__D.yaml +0 -15
- dfm_python-0.5.52/config/series/KOHWRWEMP.yaml +0 -15
- dfm_python-0.5.52/config/series/KOIMNGS_D.yaml +0 -14
- dfm_python-0.5.52/config/series/KOIMPCONA.yaml +0 -16
- dfm_python-0.5.52/config/series/KOIMPGDDA.yaml +0 -16
- dfm_python-0.5.52/config/series/KOIMPGDSA.yaml +0 -15
- dfm_python-0.5.52/config/series/KOIMPPRCF.yaml +0 -15
- dfm_python-0.5.52/config/series/KOIPALL_G.yaml +0 -14
- dfm_python-0.5.52/config/series/KOIPMIMAG.yaml +0 -14
- dfm_python-0.5.52/config/series/KOLRLTCO.yaml +0 -15
- dfm_python-0.5.52/config/series/KOLRLTHH.yaml +0 -14
- dfm_python-0.5.52/config/series/KOMPCAPGG.yaml +0 -15
- dfm_python-0.5.52/config/series/KOMPCONDG.yaml +0 -15
- dfm_python-0.5.52/config/series/KOMPCONGG.yaml +0 -15
- dfm_python-0.5.52/config/series/KOMPCONNG.yaml +0 -15
- dfm_python-0.5.52/config/series/KOMPRI30G.yaml +0 -15
- dfm_python-0.5.52/config/series/KOMSCAPGG.yaml +0 -15
- dfm_python-0.5.52/config/series/KOMSCONGG.yaml +0 -15
- dfm_python-0.5.52/config/series/KONETTRDF.yaml +0 -16
- dfm_python-0.5.52/config/series/KONEWCONA.yaml +0 -16
- dfm_python-0.5.52/config/series/KOPICAPGG.yaml +0 -15
- dfm_python-0.5.52/config/series/KOPICONGG.yaml +0 -15
- dfm_python-0.5.52/config/series/KOPIMANUG.yaml +0 -14
- dfm_python-0.5.52/config/series/KOPOPACTE.yaml +0 -15
- dfm_python-0.5.52/config/series/KOPPSRM_F.yaml +0 -15
- dfm_python-0.5.52/config/series/KOPROPRCF.yaml +0 -15
- dfm_python-0.5.52/config/series/KOPSMANUG.yaml +0 -14
- dfm_python-0.5.52/config/series/KORCNST.yaml +0 -11
- dfm_python-0.5.52/config/series/KORELEC.yaml +0 -14
- dfm_python-0.5.52/config/series/KORFBEV.yaml +0 -14
- dfm_python-0.5.52/config/series/KORMACH.yaml +0 -11
- dfm_python-0.5.52/config/series/KORMCMP.yaml +0 -11
- dfm_python-0.5.52/config/series/KOROCOINF.yaml +0 -14
- dfm_python-0.5.52/config/series/KORWHLS.yaml +0 -14
- dfm_python-0.5.52/config/series/KOSHRPRCF.yaml +0 -15
- dfm_python-0.5.52/config/series/KOSIAHOTE.yaml +0 -15
- dfm_python-0.5.52/config/series/KOSIAI__E.yaml +0 -15
- dfm_python-0.5.52/config/series/KOSIARRLE.yaml +0 -14
- dfm_python-0.5.52/config/series/KOSIAWRTE.yaml +0 -15
- dfm_python-0.5.52/config/series/KOSSBFMBE.yaml +0 -14
- dfm_python-0.5.52/config/series/KOUN_TOTQ.yaml +0 -15
- dfm_python-0.5.52/config/series/KOUS____.yaml +0 -16
- dfm_python-0.5.52/config/series/KOVALCONA.yaml +0 -16
- dfm_python-0.5.52/config/series/KOWRCCNSE.yaml +0 -15
- dfm_python-0.5.52/config/series/KOWRCDURE.yaml +0 -15
- dfm_python-0.5.52/config/series/KOWRCNODE.yaml +0 -15
- dfm_python-0.5.52/config/series/KOWRCSEME.yaml +0 -15
- dfm_python-0.5.52/src/dfm_python/config/__init__.py +0 -60
- dfm_python-0.5.52/src/dfm_python/config/adapter.py +0 -655
- dfm_python-0.5.52/src/dfm_python/config/results.py +0 -405
- dfm_python-0.5.52/src/dfm_python/config/schema.py +0 -931
- dfm_python-0.5.52/src/dfm_python/config/utils.py +0 -547
- dfm_python-0.5.52/src/dfm_python/data/__init__.py +0 -30
- dfm_python-0.5.52/src/dfm_python/data/utils.py +0 -334
- dfm_python-0.5.52/src/dfm_python/encoder/pca.py +0 -296
- dfm_python-0.5.52/src/dfm_python/lightning/__init__.py +0 -53
- dfm_python-0.5.52/src/dfm_python/lightning/ddfm_dm.py +0 -417
- dfm_python-0.5.52/src/dfm_python/lightning/dfm_dm.py +0 -379
- dfm_python-0.5.52/src/dfm_python/lightning/utils.py +0 -516
- dfm_python-0.5.52/src/dfm_python/models/base.py +0 -838
- dfm_python-0.5.52/src/dfm_python/models/dfm.py +0 -1137
- dfm_python-0.5.52/src/dfm_python/models/utils.py +0 -470
- dfm_python-0.5.52/src/dfm_python/ssm/__init__.py +0 -47
- dfm_python-0.5.52/src/dfm_python/ssm/em.py +0 -1256
- dfm_python-0.5.52/src/dfm_python/ssm/kalman.py +0 -896
- dfm_python-0.5.52/src/dfm_python/ssm/utils.py +0 -430
- dfm_python-0.5.52/src/dfm_python/trainer/ddfm.py +0 -178
- dfm_python-0.5.52/src/dfm_python/utils/__init__.py +0 -148
- dfm_python-0.5.52/src/dfm_python/utils/data.py +0 -604
- dfm_python-0.5.52/src/dfm_python/utils/diagnostics.py +0 -577
- dfm_python-0.5.52/src/dfm_python/utils/helpers.py +0 -454
- dfm_python-0.5.52/src/dfm_python/utils/statespace.py +0 -1270
- dfm_python-0.5.52/src/dfm_python/utils/time.py +0 -1047
- dfm_python-0.5.52/src/test/test_config.py +0 -383
- dfm_python-0.5.52/src/test/test_datamodule.py +0 -554
- dfm_python-0.5.52/src/test/test_decoder.py +0 -372
- dfm_python-0.5.52/src/test/test_encoder.py +0 -461
- dfm_python-0.5.52/src/test/test_helpers.py +0 -427
- dfm_python-0.5.52/src/test/test_logger.py +0 -190
- dfm_python-0.5.52/src/test/test_mixed_frequency.py +0 -335
- dfm_python-0.5.52/src/test/test_models.py +0 -345
- dfm_python-0.5.52/src/test/test_predict.py +0 -419
- dfm_python-0.5.52/src/test/test_sktime_integration.py +0 -474
- dfm_python-0.5.52/src/test/test_ssm.py +0 -371
- dfm_python-0.5.52/src/test/test_trainer.py +0 -235
- dfm_python-0.5.52/src/test/test_utils.py +0 -373
- dfm_python-0.5.52/test_update_manual.py +0 -136
- dfm_python-0.5.52/tutorial/tutorial_finance_ddfm.py +0 -331
- dfm_python-0.5.52/tutorial/tutorial_finance_dfm.py +0 -327
- dfm_python-0.5.52/tutorial/tutorial_macro_ddfm.py +0 -390
- dfm_python-0.5.52/tutorial/tutorial_macro_dfm.py +0 -414
- {dfm_python-0.5.52 → dfm_python-0.5.54}/.git +0 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/.gitignore +0 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/.python-version +0 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/LICENSE +0 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/MANIFEST.in +0 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/data/finance.csv +0 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/data/macro.csv +0 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/src/dfm_python/decoder/__init__.py +0 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/src/dfm_python/decoder/linear.py +0 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/src/dfm_python/encoder/base.py +0 -0
- /dfm_python-0.5.52/config/experiment/test_finance.yaml → /dfm_python-0.5.54/src/dfm_python/encoder/variational_encoder.py +0 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/src/dfm_python/logger/__init__.py +0 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/src/dfm_python/logger/logger.py +0 -0
- {dfm_python-0.5.52 → dfm_python-0.5.54}/src/dfm_python/logger/train_logger.py +0 -0
- /dfm_python-0.5.52/config/experiment/test_macro.yaml → /dfm_python-0.5.54/src/dfm_python/ssm/arma.py +0 -0
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dfm-python
|
|
3
|
+
Version: 0.5.54
|
|
4
|
+
Summary: Dynamic Factor Model (DFM) estimation and forecasting in Python
|
|
5
|
+
Project-URL: Homepage, https://github.com/yourusername/dfm-python
|
|
6
|
+
Project-URL: Documentation, https://github.com/yourusername/dfm-python#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/yourusername/dfm-python
|
|
8
|
+
Project-URL: Issues, https://github.com/yourusername/dfm-python/issues
|
|
9
|
+
Author: Minkey Chang
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: dfm,dynamic-factor-model,econometrics,forecasting,time-series
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Requires-Dist: einops>=0.8.1
|
|
23
|
+
Requires-Dist: hydra-core>=1.3.2
|
|
24
|
+
Requires-Dist: matplotlib>=3.5.0
|
|
25
|
+
Requires-Dist: numpy>=1.24.0
|
|
26
|
+
Requires-Dist: pandas>=2.0.0
|
|
27
|
+
Requires-Dist: pyarrow>=22.0.0
|
|
28
|
+
Requires-Dist: pykalman>=0.11.0
|
|
29
|
+
Requires-Dist: pytorch-lightning>=2.0.0
|
|
30
|
+
Requires-Dist: scikit-learn>=1.7.2
|
|
31
|
+
Requires-Dist: scipy>=1.10.0
|
|
32
|
+
Requires-Dist: sktime>=0.40.1
|
|
33
|
+
Requires-Dist: torch>=2.0.0
|
|
34
|
+
Requires-Dist: twine>=6.2.0
|
|
35
|
+
Provides-Extra: all
|
|
36
|
+
Requires-Dist: hydra-core>=1.3.0; extra == 'all'
|
|
37
|
+
Requires-Dist: omegaconf>=2.3.0; extra == 'all'
|
|
38
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'all'
|
|
39
|
+
Requires-Dist: pytest>=7.0.0; extra == 'all'
|
|
40
|
+
Requires-Dist: scikit-learn>=1.0.0; extra == 'all'
|
|
41
|
+
Requires-Dist: sktime>=0.27.0; extra == 'all'
|
|
42
|
+
Requires-Dist: sqlalchemy>=2.0.0; extra == 'all'
|
|
43
|
+
Provides-Extra: db
|
|
44
|
+
Requires-Dist: sqlalchemy>=2.0.0; extra == 'db'
|
|
45
|
+
Provides-Extra: deep
|
|
46
|
+
Provides-Extra: dev
|
|
47
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
48
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
49
|
+
Requires-Dist: scikit-learn>=1.0.0; extra == 'dev'
|
|
50
|
+
Provides-Extra: forecasting
|
|
51
|
+
Requires-Dist: sktime[forecasting]>=0.40.1; extra == 'forecasting'
|
|
52
|
+
Provides-Extra: hydra
|
|
53
|
+
Requires-Dist: hydra-core>=1.3.0; extra == 'hydra'
|
|
54
|
+
Requires-Dist: omegaconf>=2.3.0; extra == 'hydra'
|
|
55
|
+
Provides-Extra: transform
|
|
56
|
+
Requires-Dist: sktime>=0.27.0; extra == 'transform'
|
|
57
|
+
Description-Content-Type: text/markdown
|
|
58
|
+
|
|
59
|
+
# dfm-python: Dynamic Factor Models for Python
|
|
60
|
+
|
|
61
|
+
A comprehensive Python package for Dynamic Factor Models (DFM), Deep Dynamic Factor Models (DDFM), and Kernelized Dynamic Factor Models (KDFM).
|
|
62
|
+
|
|
63
|
+
## Overview
|
|
64
|
+
|
|
65
|
+
This package provides implementations of three factor model variants:
|
|
66
|
+
|
|
67
|
+
- **DFM (Dynamic Factor Model)**: Linear factor model with EM algorithm estimation
|
|
68
|
+
- **DDFM (Deep Dynamic Factor Model)**: Nonlinear encoder with PyTorch and MCMC training
|
|
69
|
+
- **KDFM (Kernelized Dynamic Factor Model)**: Two-stage VARMA architecture with Krylov FFT for O(T log T) efficiency
|
|
70
|
+
|
|
71
|
+
## Installation
|
|
72
|
+
|
|
73
|
+
### Prerequisites
|
|
74
|
+
|
|
75
|
+
- Python 3.8+
|
|
76
|
+
- PyTorch 1.9+
|
|
77
|
+
- NumPy, Pandas
|
|
78
|
+
- scikit-learn, sktime (for preprocessing)
|
|
79
|
+
- statsmodels (for VAR/VECM benchmarks)
|
|
80
|
+
- pytorch-lightning (for KDFM/DDFM training)
|
|
81
|
+
|
|
82
|
+
### Install from Source
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Clone repository (if not already available)
|
|
86
|
+
cd dfm-python
|
|
87
|
+
|
|
88
|
+
# Install in development mode
|
|
89
|
+
pip install -e .
|
|
90
|
+
|
|
91
|
+
# Or using uv
|
|
92
|
+
uv pip install -e .
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Quick Start
|
|
96
|
+
|
|
97
|
+
### KDFM Example
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
from dfm_python import KDFM, KDFMDataModule, KDFMTrainer
|
|
101
|
+
from dfm_python.config import KDFMConfig, SeriesConfig
|
|
102
|
+
import pandas as pd
|
|
103
|
+
|
|
104
|
+
# Load data
|
|
105
|
+
df = pd.read_csv('data/your_data.csv')
|
|
106
|
+
df_processed = df[[col for col in df.columns if col != 'date']]
|
|
107
|
+
|
|
108
|
+
# Create configuration
|
|
109
|
+
series_configs = [SeriesConfig(series_id=col, frequency='d') for col in df_processed.columns]
|
|
110
|
+
config = KDFMConfig(
|
|
111
|
+
series=series_configs,
|
|
112
|
+
ar_order=1,
|
|
113
|
+
ma_order=0,
|
|
114
|
+
structural_method='cholesky',
|
|
115
|
+
learning_rate=0.001,
|
|
116
|
+
max_epochs=50,
|
|
117
|
+
batch_size=32
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
# Create DataModule
|
|
121
|
+
data_module = KDFMDataModule(config=config, data=df_processed)
|
|
122
|
+
data_module.setup()
|
|
123
|
+
|
|
124
|
+
# Create model
|
|
125
|
+
model = KDFM(
|
|
126
|
+
config=config,
|
|
127
|
+
ar_order=1,
|
|
128
|
+
ma_order=0,
|
|
129
|
+
learning_rate=0.001,
|
|
130
|
+
max_epochs=50
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
# Initialize from data
|
|
134
|
+
sample_batch = next(iter(data_module.train_dataloader()))
|
|
135
|
+
sample_data = sample_batch[0] if isinstance(sample_batch, (tuple, list)) else sample_batch
|
|
136
|
+
if sample_data.ndim == 3:
|
|
137
|
+
sample_data = sample_data[0]
|
|
138
|
+
model.initialize_from_data(sample_data)
|
|
139
|
+
|
|
140
|
+
# Train
|
|
141
|
+
trainer = KDFMTrainer(max_epochs=50, enable_progress_bar=True)
|
|
142
|
+
trainer.fit(model, data_module)
|
|
143
|
+
|
|
144
|
+
# Predict
|
|
145
|
+
X_forecast, Z_forecast = model.predict(horizon=6)
|
|
146
|
+
print(f"Forecast shape: {X_forecast.shape}")
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### DFM Example
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from dfm_python import DFM, DFMDataModule, DFMTrainer
|
|
153
|
+
import pandas as pd
|
|
154
|
+
|
|
155
|
+
# Load data
|
|
156
|
+
df = pd.read_csv('data/your_data.csv')
|
|
157
|
+
|
|
158
|
+
# Create DataModule
|
|
159
|
+
data_module = DFMDataModule(config_path='config/dfm_config.yaml', data=df)
|
|
160
|
+
data_module.setup()
|
|
161
|
+
|
|
162
|
+
# Create and fit model
|
|
163
|
+
model = DFM()
|
|
164
|
+
model.load_config('config/dfm_config.yaml')
|
|
165
|
+
model.fit(data_module.get_processed_data())
|
|
166
|
+
|
|
167
|
+
# Predict
|
|
168
|
+
X_forecast = model.predict(horizon=6)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Package Structure
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
dfm-python/
|
|
175
|
+
├── src/
|
|
176
|
+
│ └── dfm_python/
|
|
177
|
+
│ ├── models/ # Model implementations (DFM, DDFM, KDFM)
|
|
178
|
+
│ ├── config/ # Configuration schemas
|
|
179
|
+
│ ├── datamodule/ # PyTorch Lightning DataModules
|
|
180
|
+
│ ├── trainer/ # Training procedures
|
|
181
|
+
│ ├── ssm/ # State-space model components
|
|
182
|
+
│ ├── dataset/ # Data loading and preprocessing
|
|
183
|
+
│ └── utils/ # Utility functions
|
|
184
|
+
├── tutorial/ # Tutorial scripts and examples
|
|
185
|
+
├── tests/ # Test suite
|
|
186
|
+
└── README.md # This file
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Key Features
|
|
190
|
+
|
|
191
|
+
### KDFM (Kernelized Dynamic Factor Model)
|
|
192
|
+
|
|
193
|
+
- **Two-stage VARMA architecture**: AR stage for VAR coefficients, optional MA stage for moving average dynamics
|
|
194
|
+
- **Structural identification**: Learnable structural shock identification (Cholesky, full, low-rank)
|
|
195
|
+
- **Efficient computation**: Krylov FFT for O(T log T) forward pass
|
|
196
|
+
- **Direct IRF computation**: Avoids numerical error accumulation
|
|
197
|
+
- **Gradient descent training**: Uses PyTorch Lightning for training
|
|
198
|
+
|
|
199
|
+
### DFM (Dynamic Factor Model)
|
|
200
|
+
|
|
201
|
+
- **EM algorithm**: Expectation-Maximization for parameter estimation
|
|
202
|
+
- **Block structure**: Supports mixed-frequency data with block-organized factors
|
|
203
|
+
- **Kalman filtering**: Uses pykalman for efficient state estimation
|
|
204
|
+
- **NumPy-based**: All computations in NumPy for numerical stability
|
|
205
|
+
|
|
206
|
+
### DDFM (Deep Dynamic Factor Model)
|
|
207
|
+
|
|
208
|
+
- **Nonlinear encoder**: Neural network encoder for nonlinear factor extraction
|
|
209
|
+
- **MCMC training**: Denoising training procedure
|
|
210
|
+
- **PyTorch-based**: Full PyTorch implementation with Lightning support
|
|
211
|
+
|
|
212
|
+
## IRF Analysis: KDFM's PRIMARY CONTRIBUTION
|
|
213
|
+
|
|
214
|
+
**IRF (Impulse Response Function) analysis is KDFM's PRIMARY CONTRIBUTION and fundamental innovation**. Unlike traditional models that compute IRFs as post-processing steps (VAR) or treat them as implicit filters (SpaceTime), KDFM estimates IRFs **directly as the primary object of estimation**, built into the model architecture via companion matrix parameterization. This direct IRF estimation enables explicit structural shock analysis with orthogonal, interpretable shocks that traditional models cannot provide.
|
|
215
|
+
|
|
216
|
+
### Key Concepts
|
|
217
|
+
|
|
218
|
+
- **Direct IRF Estimation (PRIMARY CONTRIBUTION)**: KDFM estimates IRF directly as the primary object via companion matrix powers $K_h = C (A^{\text{AR}})^h B$, making IRF estimation the primary goal rather than a derived quantity. This architectural innovation distinguishes KDFM from all existing models.
|
|
219
|
+
- **Reduced-form IRF**: Response to reduced-form residuals (correlated shocks), computed directly as matrix powers
|
|
220
|
+
- **Structural IRF**: Response to orthogonal structural shocks (causally interpretable), computed as $K_h^{\text{struct}} = K_h S$ where $S$ is the learnable structural identification matrix
|
|
221
|
+
- **Explicit Shock Analysis**: Structural shocks $\varepsilon_t$ are directly interpretable (orthogonal, unit variance), enabling causal interpretation where each shock has clear economic/scientific meaning
|
|
222
|
+
- **Numerical Stability**: Direct matrix power computation avoids error accumulation that occurs in traditional VAR methods when converting coefficients to moving average representation recursively
|
|
223
|
+
|
|
224
|
+
### Quick Example
|
|
225
|
+
|
|
226
|
+
```python
|
|
227
|
+
from dfm_python.models.functional.irf import compute_irf
|
|
228
|
+
import torch
|
|
229
|
+
|
|
230
|
+
# After training KDFM model, extract companion matrices
|
|
231
|
+
ar_transition = model.companion_ar.get_companion_matrix()
|
|
232
|
+
B = model.companion_ar.B
|
|
233
|
+
C = model.companion_ar.C
|
|
234
|
+
S = model.structural_id.get_structural_matrix()
|
|
235
|
+
|
|
236
|
+
# For pure VAR (ma_order=0), MA stage is identity
|
|
237
|
+
K = ar_transition.shape[0] // config.ar_order
|
|
238
|
+
ma_transition = torch.eye(K, device=ar_transition.device)
|
|
239
|
+
B_prime = torch.eye(K, device=B.device)
|
|
240
|
+
C_prime = torch.eye(K, device=C.device)
|
|
241
|
+
|
|
242
|
+
# Compute IRF
|
|
243
|
+
irf_reduced, irf_structural = compute_irf(
|
|
244
|
+
A_ar=ar_transition,
|
|
245
|
+
A_ma=ma_transition,
|
|
246
|
+
B=B, C=C,
|
|
247
|
+
B_prime=B_prime, C_prime=C_prime,
|
|
248
|
+
S=S,
|
|
249
|
+
horizon=20,
|
|
250
|
+
structural=True
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
# irf_structural shape: (20, K, K)
|
|
254
|
+
# irf_structural[h, i, j] = response of variable i to structural shock j at horizon h
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### IRF Tutorial
|
|
258
|
+
|
|
259
|
+
See `tutorial/tutorial_irf_analysis.py` for a comprehensive IRF analysis tutorial covering:
|
|
260
|
+
- Computing reduced-form and structural IRFs
|
|
261
|
+
- Visualizing IRF responses
|
|
262
|
+
- Interpreting IRF results
|
|
263
|
+
- Comparing IRFs across models
|
|
264
|
+
|
|
265
|
+
## Documentation
|
|
266
|
+
|
|
267
|
+
- **Tutorials**: See `tutorial/` directory for detailed examples
|
|
268
|
+
- **IRF Tutorial**: `tutorial/tutorial_irf_analysis.py` - Comprehensive IRF analysis guide
|
|
269
|
+
- **API Documentation**: See docstrings in source code
|
|
270
|
+
- **Examples**:
|
|
271
|
+
- `tutorial/tutorial_macro_kdfm.py` - KDFM for macro data
|
|
272
|
+
- `tutorial/tutorial_finance_kdfm.py` - KDFM for finance data
|
|
273
|
+
- `tutorial/tutorial_irf_analysis.py` - IRF analysis (PRIMARY STRENGTH)
|
|
274
|
+
|
|
275
|
+
## Testing
|
|
276
|
+
|
|
277
|
+
Run tests to verify installation:
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
# Run all tests
|
|
281
|
+
pytest dfm-python/src/test/test_*.py -v
|
|
282
|
+
|
|
283
|
+
# Run specific model tests
|
|
284
|
+
pytest dfm-python/src/test/test_models.py::TestKDFM -v
|
|
285
|
+
pytest dfm-python/src/test/test_models.py::TestDFM -v
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Citation
|
|
289
|
+
|
|
290
|
+
If you use this package in your research, please cite:
|
|
291
|
+
|
|
292
|
+
```bibtex
|
|
293
|
+
@article{kdfm2026,
|
|
294
|
+
title={Kernelized Dynamic Factor Models for Scientific Time Series},
|
|
295
|
+
author={...},
|
|
296
|
+
journal={ICLR},
|
|
297
|
+
year={2026}
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Troubleshooting
|
|
302
|
+
|
|
303
|
+
### Common Errors and Solutions
|
|
304
|
+
|
|
305
|
+
#### Method Signature Error: `_can_compute_irf() takes 7 positional arguments but 8 were given`
|
|
306
|
+
|
|
307
|
+
**Error**: This error occurs when calling `model.get_result()` or during forecast generation.
|
|
308
|
+
|
|
309
|
+
**Cause**: Method signature mismatch in `_can_compute_irf()` method (fixed in v0.5.5+).
|
|
310
|
+
|
|
311
|
+
**Solution**:
|
|
312
|
+
- Ensure you're using the latest version of dfm-python (v0.5.5+)
|
|
313
|
+
- The method signature has been fixed in Iteration 11
|
|
314
|
+
- If error persists, check that `dfm-python/src/dfm_python/models/kdfm.py` has the correct method signature
|
|
315
|
+
- The method should return `Tuple[bool, str]` and accept 6 parameters (excluding self): `ma_transition, ar_input, ar_output, ma_input, ma_output, structural_matrix`
|
|
316
|
+
|
|
317
|
+
**Fixed in**: Iteration 11 (2025-12-29)
|
|
318
|
+
|
|
319
|
+
#### Forecast Generation Errors
|
|
320
|
+
|
|
321
|
+
**Error**: Forecasts contain NaN/Inf values or method signature errors.
|
|
322
|
+
|
|
323
|
+
**Causes**:
|
|
324
|
+
1. Method signature mismatch (fixed in Iteration 11)
|
|
325
|
+
2. Numerical instability in companion matrix (eigenvalues >= 1.0)
|
|
326
|
+
3. Missing or incorrect inverse transformation
|
|
327
|
+
|
|
328
|
+
**Solutions**:
|
|
329
|
+
1. Ensure method signature fix is applied (see above)
|
|
330
|
+
2. Check companion matrix stability: `max_eigenvalue < 1.0`
|
|
331
|
+
3. Verify inverse transformation is applied correctly
|
|
332
|
+
4. Check forecast generation logs for detailed error messages
|
|
333
|
+
5. Use `experiment/scripts/kdfm_forecasts.py` which includes comprehensive error handling
|
|
334
|
+
|
|
335
|
+
#### Eigenvalue Inconsistencies
|
|
336
|
+
|
|
337
|
+
**Error**: Eigenvalues differ between source files and comprehensive analysis.
|
|
338
|
+
|
|
339
|
+
**Solution**:
|
|
340
|
+
- Source of truth: `results/kdfm_analysis/*_kdfm_results.json` files
|
|
341
|
+
- Regenerate `comprehensive_analysis.json` using: `python experiment/utils/comprehensive_result_analysis.py`
|
|
342
|
+
- Validation automatically detects inconsistencies
|
|
343
|
+
|
|
344
|
+
### API Reference
|
|
345
|
+
|
|
346
|
+
#### IRF Computation
|
|
347
|
+
|
|
348
|
+
The IRF computation API is consistent across all methods:
|
|
349
|
+
|
|
350
|
+
- `compute_irf()`: Main function for IRF computation (in `dfm_python.models.functional.irf`)
|
|
351
|
+
- `_can_compute_irf()`: Validation method (in `KDFM` class)
|
|
352
|
+
- `_compute_irfs_from_params()`: Parameter-based IRF computation (in `KDFM` class)
|
|
353
|
+
|
|
354
|
+
**Method Signature**:
|
|
355
|
+
```python
|
|
356
|
+
def _can_compute_irf(
|
|
357
|
+
self,
|
|
358
|
+
ma_transition: Optional[np.ndarray],
|
|
359
|
+
ar_input: Optional[np.ndarray],
|
|
360
|
+
ar_output: Optional[np.ndarray],
|
|
361
|
+
ma_input: Optional[np.ndarray],
|
|
362
|
+
ma_output: Optional[np.ndarray],
|
|
363
|
+
structural_matrix: Optional[np.ndarray]
|
|
364
|
+
) -> Tuple[bool, str]:
|
|
365
|
+
"""Returns (can_compute, error_msg) tuple."""
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
**Note**: `ar_transition` is NOT a parameter (only used in actual IRF computation, not validation).
|
|
369
|
+
|
|
370
|
+
## License
|
|
371
|
+
|
|
372
|
+
[Specify license]
|
|
373
|
+
|
|
374
|
+
## Contributing
|
|
375
|
+
|
|
376
|
+
[Contributing guidelines]
|
|
377
|
+
|
|
378
|
+
## Support
|
|
379
|
+
|
|
380
|
+
[Support information]
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
# dfm-python: Dynamic Factor Models for Python
|
|
2
|
+
|
|
3
|
+
A comprehensive Python package for Dynamic Factor Models (DFM), Deep Dynamic Factor Models (DDFM), and Kernelized Dynamic Factor Models (KDFM).
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package provides implementations of three factor model variants:
|
|
8
|
+
|
|
9
|
+
- **DFM (Dynamic Factor Model)**: Linear factor model with EM algorithm estimation
|
|
10
|
+
- **DDFM (Deep Dynamic Factor Model)**: Nonlinear encoder with PyTorch and MCMC training
|
|
11
|
+
- **KDFM (Kernelized Dynamic Factor Model)**: Two-stage VARMA architecture with Krylov FFT for O(T log T) efficiency
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
### Prerequisites
|
|
16
|
+
|
|
17
|
+
- Python 3.8+
|
|
18
|
+
- PyTorch 1.9+
|
|
19
|
+
- NumPy, Pandas
|
|
20
|
+
- scikit-learn, sktime (for preprocessing)
|
|
21
|
+
- statsmodels (for VAR/VECM benchmarks)
|
|
22
|
+
- pytorch-lightning (for KDFM/DDFM training)
|
|
23
|
+
|
|
24
|
+
### Install from Source
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Clone repository (if not already available)
|
|
28
|
+
cd dfm-python
|
|
29
|
+
|
|
30
|
+
# Install in development mode
|
|
31
|
+
pip install -e .
|
|
32
|
+
|
|
33
|
+
# Or using uv
|
|
34
|
+
uv pip install -e .
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
### KDFM Example
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from dfm_python import KDFM, KDFMDataModule, KDFMTrainer
|
|
43
|
+
from dfm_python.config import KDFMConfig, SeriesConfig
|
|
44
|
+
import pandas as pd
|
|
45
|
+
|
|
46
|
+
# Load data
|
|
47
|
+
df = pd.read_csv('data/your_data.csv')
|
|
48
|
+
df_processed = df[[col for col in df.columns if col != 'date']]
|
|
49
|
+
|
|
50
|
+
# Create configuration
|
|
51
|
+
series_configs = [SeriesConfig(series_id=col, frequency='d') for col in df_processed.columns]
|
|
52
|
+
config = KDFMConfig(
|
|
53
|
+
series=series_configs,
|
|
54
|
+
ar_order=1,
|
|
55
|
+
ma_order=0,
|
|
56
|
+
structural_method='cholesky',
|
|
57
|
+
learning_rate=0.001,
|
|
58
|
+
max_epochs=50,
|
|
59
|
+
batch_size=32
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# Create DataModule
|
|
63
|
+
data_module = KDFMDataModule(config=config, data=df_processed)
|
|
64
|
+
data_module.setup()
|
|
65
|
+
|
|
66
|
+
# Create model
|
|
67
|
+
model = KDFM(
|
|
68
|
+
config=config,
|
|
69
|
+
ar_order=1,
|
|
70
|
+
ma_order=0,
|
|
71
|
+
learning_rate=0.001,
|
|
72
|
+
max_epochs=50
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
# Initialize from data
|
|
76
|
+
sample_batch = next(iter(data_module.train_dataloader()))
|
|
77
|
+
sample_data = sample_batch[0] if isinstance(sample_batch, (tuple, list)) else sample_batch
|
|
78
|
+
if sample_data.ndim == 3:
|
|
79
|
+
sample_data = sample_data[0]
|
|
80
|
+
model.initialize_from_data(sample_data)
|
|
81
|
+
|
|
82
|
+
# Train
|
|
83
|
+
trainer = KDFMTrainer(max_epochs=50, enable_progress_bar=True)
|
|
84
|
+
trainer.fit(model, data_module)
|
|
85
|
+
|
|
86
|
+
# Predict
|
|
87
|
+
X_forecast, Z_forecast = model.predict(horizon=6)
|
|
88
|
+
print(f"Forecast shape: {X_forecast.shape}")
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### DFM Example
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from dfm_python import DFM, DFMDataModule, DFMTrainer
|
|
95
|
+
import pandas as pd
|
|
96
|
+
|
|
97
|
+
# Load data
|
|
98
|
+
df = pd.read_csv('data/your_data.csv')
|
|
99
|
+
|
|
100
|
+
# Create DataModule
|
|
101
|
+
data_module = DFMDataModule(config_path='config/dfm_config.yaml', data=df)
|
|
102
|
+
data_module.setup()
|
|
103
|
+
|
|
104
|
+
# Create and fit model
|
|
105
|
+
model = DFM()
|
|
106
|
+
model.load_config('config/dfm_config.yaml')
|
|
107
|
+
model.fit(data_module.get_processed_data())
|
|
108
|
+
|
|
109
|
+
# Predict
|
|
110
|
+
X_forecast = model.predict(horizon=6)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Package Structure
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
dfm-python/
|
|
117
|
+
├── src/
|
|
118
|
+
│ └── dfm_python/
|
|
119
|
+
│ ├── models/ # Model implementations (DFM, DDFM, KDFM)
|
|
120
|
+
│ ├── config/ # Configuration schemas
|
|
121
|
+
│ ├── datamodule/ # PyTorch Lightning DataModules
|
|
122
|
+
│ ├── trainer/ # Training procedures
|
|
123
|
+
│ ├── ssm/ # State-space model components
|
|
124
|
+
│ ├── dataset/ # Data loading and preprocessing
|
|
125
|
+
│ └── utils/ # Utility functions
|
|
126
|
+
├── tutorial/ # Tutorial scripts and examples
|
|
127
|
+
├── tests/ # Test suite
|
|
128
|
+
└── README.md # This file
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Key Features
|
|
132
|
+
|
|
133
|
+
### KDFM (Kernelized Dynamic Factor Model)
|
|
134
|
+
|
|
135
|
+
- **Two-stage VARMA architecture**: AR stage for VAR coefficients, optional MA stage for moving average dynamics
|
|
136
|
+
- **Structural identification**: Learnable structural shock identification (Cholesky, full, low-rank)
|
|
137
|
+
- **Efficient computation**: Krylov FFT for O(T log T) forward pass
|
|
138
|
+
- **Direct IRF computation**: Avoids numerical error accumulation
|
|
139
|
+
- **Gradient descent training**: Uses PyTorch Lightning for training
|
|
140
|
+
|
|
141
|
+
### DFM (Dynamic Factor Model)
|
|
142
|
+
|
|
143
|
+
- **EM algorithm**: Expectation-Maximization for parameter estimation
|
|
144
|
+
- **Block structure**: Supports mixed-frequency data with block-organized factors
|
|
145
|
+
- **Kalman filtering**: Uses pykalman for efficient state estimation
|
|
146
|
+
- **NumPy-based**: All computations in NumPy for numerical stability
|
|
147
|
+
|
|
148
|
+
### DDFM (Deep Dynamic Factor Model)
|
|
149
|
+
|
|
150
|
+
- **Nonlinear encoder**: Neural network encoder for nonlinear factor extraction
|
|
151
|
+
- **MCMC training**: Denoising training procedure
|
|
152
|
+
- **PyTorch-based**: Full PyTorch implementation with Lightning support
|
|
153
|
+
|
|
154
|
+
## IRF Analysis: KDFM's PRIMARY CONTRIBUTION
|
|
155
|
+
|
|
156
|
+
**IRF (Impulse Response Function) analysis is KDFM's PRIMARY CONTRIBUTION and fundamental innovation**. Unlike traditional models that compute IRFs as post-processing steps (VAR) or treat them as implicit filters (SpaceTime), KDFM estimates IRFs **directly as the primary object of estimation**, built into the model architecture via companion matrix parameterization. This direct IRF estimation enables explicit structural shock analysis with orthogonal, interpretable shocks that traditional models cannot provide.
|
|
157
|
+
|
|
158
|
+
### Key Concepts
|
|
159
|
+
|
|
160
|
+
- **Direct IRF Estimation (PRIMARY CONTRIBUTION)**: KDFM estimates IRF directly as the primary object via companion matrix powers $K_h = C (A^{\text{AR}})^h B$, making IRF estimation the primary goal rather than a derived quantity. This architectural innovation distinguishes KDFM from all existing models.
|
|
161
|
+
- **Reduced-form IRF**: Response to reduced-form residuals (correlated shocks), computed directly as matrix powers
|
|
162
|
+
- **Structural IRF**: Response to orthogonal structural shocks (causally interpretable), computed as $K_h^{\text{struct}} = K_h S$ where $S$ is the learnable structural identification matrix
|
|
163
|
+
- **Explicit Shock Analysis**: Structural shocks $\varepsilon_t$ are directly interpretable (orthogonal, unit variance), enabling causal interpretation where each shock has clear economic/scientific meaning
|
|
164
|
+
- **Numerical Stability**: Direct matrix power computation avoids error accumulation that occurs in traditional VAR methods when converting coefficients to moving average representation recursively
|
|
165
|
+
|
|
166
|
+
### Quick Example
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
from dfm_python.models.functional.irf import compute_irf
|
|
170
|
+
import torch
|
|
171
|
+
|
|
172
|
+
# After training KDFM model, extract companion matrices
|
|
173
|
+
ar_transition = model.companion_ar.get_companion_matrix()
|
|
174
|
+
B = model.companion_ar.B
|
|
175
|
+
C = model.companion_ar.C
|
|
176
|
+
S = model.structural_id.get_structural_matrix()
|
|
177
|
+
|
|
178
|
+
# For pure VAR (ma_order=0), MA stage is identity
|
|
179
|
+
K = ar_transition.shape[0] // config.ar_order
|
|
180
|
+
ma_transition = torch.eye(K, device=ar_transition.device)
|
|
181
|
+
B_prime = torch.eye(K, device=B.device)
|
|
182
|
+
C_prime = torch.eye(K, device=C.device)
|
|
183
|
+
|
|
184
|
+
# Compute IRF
|
|
185
|
+
irf_reduced, irf_structural = compute_irf(
|
|
186
|
+
A_ar=ar_transition,
|
|
187
|
+
A_ma=ma_transition,
|
|
188
|
+
B=B, C=C,
|
|
189
|
+
B_prime=B_prime, C_prime=C_prime,
|
|
190
|
+
S=S,
|
|
191
|
+
horizon=20,
|
|
192
|
+
structural=True
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
# irf_structural shape: (20, K, K)
|
|
196
|
+
# irf_structural[h, i, j] = response of variable i to structural shock j at horizon h
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### IRF Tutorial
|
|
200
|
+
|
|
201
|
+
See `tutorial/tutorial_irf_analysis.py` for a comprehensive IRF analysis tutorial covering:
|
|
202
|
+
- Computing reduced-form and structural IRFs
|
|
203
|
+
- Visualizing IRF responses
|
|
204
|
+
- Interpreting IRF results
|
|
205
|
+
- Comparing IRFs across models
|
|
206
|
+
|
|
207
|
+
## Documentation
|
|
208
|
+
|
|
209
|
+
- **Tutorials**: See `tutorial/` directory for detailed examples
|
|
210
|
+
- **IRF Tutorial**: `tutorial/tutorial_irf_analysis.py` - Comprehensive IRF analysis guide
|
|
211
|
+
- **API Documentation**: See docstrings in source code
|
|
212
|
+
- **Examples**:
|
|
213
|
+
- `tutorial/tutorial_macro_kdfm.py` - KDFM for macro data
|
|
214
|
+
- `tutorial/tutorial_finance_kdfm.py` - KDFM for finance data
|
|
215
|
+
- `tutorial/tutorial_irf_analysis.py` - IRF analysis (PRIMARY STRENGTH)
|
|
216
|
+
|
|
217
|
+
## Testing
|
|
218
|
+
|
|
219
|
+
Run tests to verify installation:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
# Run all tests
|
|
223
|
+
pytest dfm-python/src/test/test_*.py -v
|
|
224
|
+
|
|
225
|
+
# Run specific model tests
|
|
226
|
+
pytest dfm-python/src/test/test_models.py::TestKDFM -v
|
|
227
|
+
pytest dfm-python/src/test/test_models.py::TestDFM -v
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Citation
|
|
231
|
+
|
|
232
|
+
If you use this package in your research, please cite:
|
|
233
|
+
|
|
234
|
+
```bibtex
|
|
235
|
+
@article{kdfm2026,
|
|
236
|
+
title={Kernelized Dynamic Factor Models for Scientific Time Series},
|
|
237
|
+
author={...},
|
|
238
|
+
journal={ICLR},
|
|
239
|
+
year={2026}
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Troubleshooting
|
|
244
|
+
|
|
245
|
+
### Common Errors and Solutions
|
|
246
|
+
|
|
247
|
+
#### Method Signature Error: `_can_compute_irf() takes 7 positional arguments but 8 were given`
|
|
248
|
+
|
|
249
|
+
**Error**: This error occurs when calling `model.get_result()` or during forecast generation.
|
|
250
|
+
|
|
251
|
+
**Cause**: Method signature mismatch in `_can_compute_irf()` method (fixed in v0.5.5+).
|
|
252
|
+
|
|
253
|
+
**Solution**:
|
|
254
|
+
- Ensure you're using the latest version of dfm-python (v0.5.5+)
|
|
255
|
+
- The method signature has been fixed in Iteration 11
|
|
256
|
+
- If error persists, check that `dfm-python/src/dfm_python/models/kdfm.py` has the correct method signature
|
|
257
|
+
- The method should return `Tuple[bool, str]` and accept 6 parameters (excluding self): `ma_transition, ar_input, ar_output, ma_input, ma_output, structural_matrix`
|
|
258
|
+
|
|
259
|
+
**Fixed in**: Iteration 11 (2025-12-29)
|
|
260
|
+
|
|
261
|
+
#### Forecast Generation Errors
|
|
262
|
+
|
|
263
|
+
**Error**: Forecasts contain NaN/Inf values or method signature errors.
|
|
264
|
+
|
|
265
|
+
**Causes**:
|
|
266
|
+
1. Method signature mismatch (fixed in Iteration 11)
|
|
267
|
+
2. Numerical instability in companion matrix (eigenvalues >= 1.0)
|
|
268
|
+
3. Missing or incorrect inverse transformation
|
|
269
|
+
|
|
270
|
+
**Solutions**:
|
|
271
|
+
1. Ensure method signature fix is applied (see above)
|
|
272
|
+
2. Check companion matrix stability: `max_eigenvalue < 1.0`
|
|
273
|
+
3. Verify inverse transformation is applied correctly
|
|
274
|
+
4. Check forecast generation logs for detailed error messages
|
|
275
|
+
5. Use `experiment/scripts/kdfm_forecasts.py` which includes comprehensive error handling
|
|
276
|
+
|
|
277
|
+
#### Eigenvalue Inconsistencies
|
|
278
|
+
|
|
279
|
+
**Error**: Eigenvalues differ between source files and comprehensive analysis.
|
|
280
|
+
|
|
281
|
+
**Solution**:
|
|
282
|
+
- Source of truth: `results/kdfm_analysis/*_kdfm_results.json` files
|
|
283
|
+
- Regenerate `comprehensive_analysis.json` using: `python experiment/utils/comprehensive_result_analysis.py`
|
|
284
|
+
- Validation automatically detects inconsistencies
|
|
285
|
+
|
|
286
|
+
### API Reference
|
|
287
|
+
|
|
288
|
+
#### IRF Computation
|
|
289
|
+
|
|
290
|
+
The IRF computation API is consistent across all methods:
|
|
291
|
+
|
|
292
|
+
- `compute_irf()`: Main function for IRF computation (in `dfm_python.models.functional.irf`)
|
|
293
|
+
- `_can_compute_irf()`: Validation method (in `KDFM` class)
|
|
294
|
+
- `_compute_irfs_from_params()`: Parameter-based IRF computation (in `KDFM` class)
|
|
295
|
+
|
|
296
|
+
**Method Signature**:
|
|
297
|
+
```python
|
|
298
|
+
def _can_compute_irf(
|
|
299
|
+
self,
|
|
300
|
+
ma_transition: Optional[np.ndarray],
|
|
301
|
+
ar_input: Optional[np.ndarray],
|
|
302
|
+
ar_output: Optional[np.ndarray],
|
|
303
|
+
ma_input: Optional[np.ndarray],
|
|
304
|
+
ma_output: Optional[np.ndarray],
|
|
305
|
+
structural_matrix: Optional[np.ndarray]
|
|
306
|
+
) -> Tuple[bool, str]:
|
|
307
|
+
"""Returns (can_compute, error_msg) tuple."""
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
**Note**: `ar_transition` is NOT a parameter (only used in actual IRF computation, not validation).
|
|
311
|
+
|
|
312
|
+
## License
|
|
313
|
+
|
|
314
|
+
[Specify license]
|
|
315
|
+
|
|
316
|
+
## Contributing
|
|
317
|
+
|
|
318
|
+
[Contributing guidelines]
|
|
319
|
+
|
|
320
|
+
## Support
|
|
321
|
+
|
|
322
|
+
[Support information]
|