dfm-python 0.4.2__tar.gz → 0.4.5__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.4.2 → dfm_python-0.4.5}/PKG-INFO +24 -64
- {dfm_python-0.4.2 → dfm_python-0.4.5}/README.md +20 -62
- dfm_python-0.4.5/config/README.md +174 -0
- dfm_python-0.4.5/config/experiment/default.yaml +82 -0
- dfm_python-0.4.5/config/experiment/myexp_20251204233620.yaml +108 -0
- dfm_python-0.4.5/config/experiment/test_experiment_20251204170512.yaml +107 -0
- dfm_python-0.4.5/config/model/arma.yaml +5 -0
- dfm_python-0.4.5/config/model/ddfm.yaml +48 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/config/model/dfm.yaml +6 -8
- dfm_python-0.4.5/config/model/tft.yaml +7 -0
- dfm_python-0.4.5/config/model/xgboost.yaml +23 -0
- dfm_python-0.4.5/config/preprocess/default.yaml +35 -0
- dfm_python-0.4.5/config/preprocess/test_preprocess_20251204170512.yaml +41 -0
- dfm_python-0.4.5/config/series/KO3YEARC.yaml +16 -0
- dfm_python-0.4.5/config/series/KOBFDSAAF.yaml +15 -0
- dfm_python-0.4.5/config/series/KOBFINAAF.yaml +16 -0
- dfm_python-0.4.5/config/series/KOBFXSAAF.yaml +16 -0
- dfm_python-0.4.5/config/series/KOBSESI_R.yaml +15 -0
- dfm_python-0.4.5/config/series/KOBSIBCEQ.yaml +15 -0
- dfm_python-0.4.5/config/series/KOBSIBCOQ.yaml +15 -0
- dfm_python-0.4.5/config/series/KOBSIBNER.yaml +15 -0
- dfm_python-0.4.5/config/series/KOBSIBNMR.yaml +15 -0
- dfm_python-0.4.5/config/series/KOBSIEMAR.yaml +16 -0
- dfm_python-0.4.5/config/series/KOBSIHAPR.yaml +16 -0
- dfm_python-0.4.5/config/series/KOBSIIMER.yaml +16 -0
- dfm_python-0.4.5/config/series/KOBSIIMPR.yaml +16 -0
- dfm_python-0.4.5/config/series/KOBSIXMER.yaml +16 -0
- dfm_python-0.4.5/config/series/KOBUSINVR.yaml +16 -0
- dfm_python-0.4.5/config/series/KOCALL_.yaml +15 -0
- dfm_python-0.4.5/config/series/KOCNFBUSR.yaml +15 -0
- dfm_python-0.4.5/config/series/KOCNFCONR.yaml +16 -0
- dfm_python-0.4.5/config/series/KOCNGOV_D.yaml +15 -0
- dfm_python-0.4.5/config/series/KOCNPER_D.yaml +16 -0
- dfm_python-0.4.5/config/series/KOCOBUSIR.yaml +15 -0
- dfm_python-0.4.5/config/series/KOCONPMTH.yaml +16 -0
- dfm_python-0.4.5/config/series/KOCONPRCF.yaml +16 -0
- dfm_python-0.4.5/config/series/KOCONSTRP.yaml +16 -0
- dfm_python-0.4.5/config/series/KOCPCOREF.yaml +16 -0
- dfm_python-0.4.5/config/series/KOCPEXFEF.yaml +16 -0
- dfm_python-0.4.5/config/series/KOCREU__A.yaml +17 -0
- dfm_python-0.4.5/config/series/KOCSECDMR.yaml +16 -0
- dfm_python-0.4.5/config/series/KOCSECEMR.yaml +16 -0
- dfm_python-0.4.5/config/series/KOCSEMEMR.yaml +17 -0
- dfm_python-0.4.5/config/series/KOCSEOHDR.yaml +16 -0
- dfm_python-0.4.5/config/series/KOCSEOHSR.yaml +16 -0
- dfm_python-0.4.5/config/series/KOCSHHEMR.yaml +16 -0
- dfm_python-0.4.5/config/series/KOCSHHLMR.yaml +16 -0
- dfm_python-0.4.5/config/series/KOCSMTTOA.yaml +17 -0
- dfm_python-0.4.5/config/series/KOCSPHIMR.yaml +16 -0
- dfm_python-0.4.5/config/series/KOCSPSPMR.yaml +16 -0
- dfm_python-0.4.5/config/series/KOCYLEADR.yaml +15 -0
- dfm_python-0.4.5/config/series/KODBLNEQA.yaml +17 -0
- dfm_python-0.4.5/config/series/KODBLNHSA.yaml +17 -0
- dfm_python-0.4.5/config/series/KOEMPCONF.yaml +17 -0
- dfm_python-0.4.5/config/series/KOEMPMANF.yaml +16 -0
- dfm_python-0.4.5/config/series/KOEMPTOTO.yaml +16 -0
- dfm_python-0.4.5/config/series/KOEMPWREP.yaml +17 -0
- dfm_python-0.4.5/config/series/KOEQUIMAE.yaml +16 -0
- dfm_python-0.4.5/config/series/KOEQUIPTE.yaml +16 -0
- dfm_python-0.4.5/config/series/KOEQUITTE.yaml +16 -0
- dfm_python-0.4.5/config/series/KOEXCHINA.yaml +17 -0
- dfm_python-0.4.5/config/series/KOEXNGS_D.yaml +16 -0
- dfm_python-0.4.5/config/series/KOEXPGDSA.yaml +17 -0
- dfm_python-0.4.5/config/series/KOEXPPRCF.yaml +16 -0
- dfm_python-0.4.5/config/series/KOGCFCNSD.yaml +16 -0
- dfm_python-0.4.5/config/series/KOGCFFNVD.yaml +16 -0
- dfm_python-0.4.5/config/series/KOGDP___D.yaml +15 -0
- dfm_python-0.4.5/config/series/KOGFCF__D.yaml +16 -0
- dfm_python-0.4.5/config/series/KOHWRWEMP.yaml +16 -0
- dfm_python-0.4.5/config/series/KOIMNGS_D.yaml +15 -0
- dfm_python-0.4.5/config/series/KOIMPCONA.yaml +17 -0
- dfm_python-0.4.5/config/series/KOIMPGDDA.yaml +17 -0
- dfm_python-0.4.5/config/series/KOIMPGDSA.yaml +16 -0
- dfm_python-0.4.5/config/series/KOIMPPRCF.yaml +16 -0
- dfm_python-0.4.5/config/series/KOIPALL_G.yaml +15 -0
- dfm_python-0.4.5/config/series/KOIPMIMAG.yaml +15 -0
- dfm_python-0.4.5/config/series/KOLRLTCO.yaml +16 -0
- dfm_python-0.4.5/config/series/KOLRLTHH.yaml +15 -0
- dfm_python-0.4.5/config/series/KOMPCAPGG.yaml +16 -0
- dfm_python-0.4.5/config/series/KOMPCONDG.yaml +16 -0
- dfm_python-0.4.5/config/series/KOMPCONGG.yaml +16 -0
- dfm_python-0.4.5/config/series/KOMPCONNG.yaml +16 -0
- dfm_python-0.4.5/config/series/KOMPRI30G.yaml +16 -0
- dfm_python-0.4.5/config/series/KOMSCAPGG.yaml +16 -0
- dfm_python-0.4.5/config/series/KOMSCONGG.yaml +16 -0
- dfm_python-0.4.5/config/series/KONETTRDF.yaml +17 -0
- dfm_python-0.4.5/config/series/KONEWCONA.yaml +17 -0
- dfm_python-0.4.5/config/series/KOPICAPGG.yaml +16 -0
- dfm_python-0.4.5/config/series/KOPICONGG.yaml +16 -0
- dfm_python-0.4.5/config/series/KOPIMANUG.yaml +15 -0
- dfm_python-0.4.5/config/series/KOPOPACTE.yaml +16 -0
- dfm_python-0.4.5/config/series/KOPPSRM_F.yaml +16 -0
- dfm_python-0.4.5/config/series/KOPROPRCF.yaml +16 -0
- dfm_python-0.4.5/config/series/KOPSMANUG.yaml +15 -0
- dfm_python-0.4.5/config/series/KORCNST.yaml +12 -0
- dfm_python-0.4.5/config/series/KORELEC.yaml +15 -0
- dfm_python-0.4.5/config/series/KORFBEV.yaml +15 -0
- dfm_python-0.4.5/config/series/KORMACH.yaml +12 -0
- dfm_python-0.4.5/config/series/KORMCMP.yaml +12 -0
- dfm_python-0.4.5/config/series/KOROCOINF.yaml +15 -0
- dfm_python-0.4.5/config/series/KORWHLS.yaml +15 -0
- dfm_python-0.4.5/config/series/KOSHRPRCF.yaml +16 -0
- dfm_python-0.4.5/config/series/KOSIAHOTE.yaml +16 -0
- dfm_python-0.4.5/config/series/KOSIAI__E.yaml +16 -0
- dfm_python-0.4.5/config/series/KOSIARRLE.yaml +15 -0
- dfm_python-0.4.5/config/series/KOSIAWRTE.yaml +16 -0
- dfm_python-0.4.5/config/series/KOSSBFMBE.yaml +15 -0
- dfm_python-0.4.5/config/series/KOUN_TOTQ.yaml +16 -0
- dfm_python-0.4.5/config/series/KOUS____.yaml +17 -0
- dfm_python-0.4.5/config/series/KOVALCONA.yaml +17 -0
- dfm_python-0.4.5/config/series/KOWRCCNSE.yaml +16 -0
- dfm_python-0.4.5/config/series/KOWRCDURE.yaml +16 -0
- dfm_python-0.4.5/config/series/KOWRCNODE.yaml +16 -0
- dfm_python-0.4.5/config/series/KOWRCSEME.yaml +16 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/pyproject.toml +5 -2
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/__init__.py +9 -11
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/config/__init__.py +8 -13
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/config/adapter.py +12 -210
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/config/results.py +18 -10
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/config/schema.py +31 -66
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/config/utils.py +13 -13
- dfm_python-0.4.5/src/dfm_python/data/__init__.py +28 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/data/dataloader.py +51 -8
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/data/utils.py +28 -30
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/encoder/vae.py +3 -2
- dfm_python-0.4.5/src/dfm_python/lightning/__init__.py +56 -0
- dfm_python-0.4.5/src/dfm_python/lightning/data_module.py +686 -0
- dfm_python-0.4.5/src/dfm_python/lightning/scaling.py +432 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/models/__init__.py +3 -3
- dfm_python-0.4.5/src/dfm_python/models/base.py +527 -0
- dfm_python-0.4.5/src/dfm_python/models/ddfm.py +2410 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/models/dfm.py +125 -586
- dfm_python-0.4.5/src/dfm_python/nowcast/__init__.py +37 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/nowcast/dataview.py +7 -7
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/nowcast/helpers.py +6 -8
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/nowcast/nowcast.py +274 -26
- dfm_python-0.4.5/src/dfm_python/nowcast/splitters.py +431 -0
- dfm_python-0.4.5/src/dfm_python/nowcast/transformers.py +330 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/nowcast/utils.py +11 -15
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/ssm/kalman.py +13 -27
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/ssm/utils.py +3 -1
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/trainer/__init__.py +22 -22
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/trainer/ddfm.py +7 -7
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/trainer/dfm.py +7 -7
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/utils/__init__.py +15 -15
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/utils/data.py +17 -20
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/utils/diagnostics.py +28 -23
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/utils/helpers.py +7 -7
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/utils/statespace.py +41 -71
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/utils/time.py +148 -249
- dfm_python-0.4.5/src/test/test_helpers.py +427 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/test/test_models.py +14 -84
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/test/test_nowcast.py +4 -4
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/test/test_pipeline_ddfm.py +367 -78
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/test/test_pipeline_dfm.py +113 -303
- dfm_python-0.4.5/src/test/test_sktime_integration.py +447 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/test/test_trainer.py +7 -87
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/test/test_utils.py +4 -4
- {dfm_python-0.4.2 → dfm_python-0.4.5}/uv.lock +656 -121
- dfm_python-0.4.2/config/experiment/base.yaml +0 -15
- dfm_python-0.4.2/config/experiment/investment_ddfm.yaml +0 -79
- dfm_python-0.4.2/config/experiment/production_dfm.yaml +0 -61
- dfm_python-0.4.2/config/experiment/production_dfm_high_factors.yaml +0 -61
- dfm_python-0.4.2/config/experiment/test_ddfm.yaml +0 -26
- dfm_python-0.4.2/config/experiment/test_dfm.yaml +0 -26
- dfm_python-0.4.2/config/model/ddfm.yaml +0 -30
- dfm_python-0.4.2/config/series/KO3YEARC.yaml +0 -12
- dfm_python-0.4.2/config/series/KOBFDSAAF.yaml +0 -11
- dfm_python-0.4.2/config/series/KOBFINAAF.yaml +0 -12
- dfm_python-0.4.2/config/series/KOBFXSAAF.yaml +0 -12
- dfm_python-0.4.2/config/series/KOBSESI_R.yaml +0 -11
- dfm_python-0.4.2/config/series/KOBSIBCEQ.yaml +0 -11
- dfm_python-0.4.2/config/series/KOBSIBCOQ.yaml +0 -11
- dfm_python-0.4.2/config/series/KOBSIBNER.yaml +0 -11
- dfm_python-0.4.2/config/series/KOBSIBNMR.yaml +0 -11
- dfm_python-0.4.2/config/series/KOBSIEMAR.yaml +0 -12
- dfm_python-0.4.2/config/series/KOBSIHAPR.yaml +0 -12
- dfm_python-0.4.2/config/series/KOBSIIMER.yaml +0 -12
- dfm_python-0.4.2/config/series/KOBSIIMPR.yaml +0 -12
- dfm_python-0.4.2/config/series/KOBSIXMER.yaml +0 -12
- dfm_python-0.4.2/config/series/KOBUSINVR.yaml +0 -12
- dfm_python-0.4.2/config/series/KOCALL_.yaml +0 -11
- dfm_python-0.4.2/config/series/KOCNFBUSR.yaml +0 -11
- dfm_python-0.4.2/config/series/KOCNFCONR.yaml +0 -12
- dfm_python-0.4.2/config/series/KOCNGOV_D.yaml +0 -11
- dfm_python-0.4.2/config/series/KOCNPER_D.yaml +0 -12
- dfm_python-0.4.2/config/series/KOCOBUSIR.yaml +0 -11
- dfm_python-0.4.2/config/series/KOCONPMTH.yaml +0 -12
- dfm_python-0.4.2/config/series/KOCONPRCF.yaml +0 -12
- dfm_python-0.4.2/config/series/KOCONSTRP.yaml +0 -12
- dfm_python-0.4.2/config/series/KOCPCOREF.yaml +0 -12
- dfm_python-0.4.2/config/series/KOCPEXFEF.yaml +0 -12
- dfm_python-0.4.2/config/series/KOCREU__A.yaml +0 -13
- dfm_python-0.4.2/config/series/KOCSECDMR.yaml +0 -12
- dfm_python-0.4.2/config/series/KOCSECEMR.yaml +0 -12
- dfm_python-0.4.2/config/series/KOCSEMEMR.yaml +0 -13
- dfm_python-0.4.2/config/series/KOCSEOHDR.yaml +0 -12
- dfm_python-0.4.2/config/series/KOCSEOHSR.yaml +0 -12
- dfm_python-0.4.2/config/series/KOCSHHEMR.yaml +0 -12
- dfm_python-0.4.2/config/series/KOCSHHLMR.yaml +0 -12
- dfm_python-0.4.2/config/series/KOCSMTTOA.yaml +0 -13
- dfm_python-0.4.2/config/series/KOCSPHIMR.yaml +0 -12
- dfm_python-0.4.2/config/series/KOCSPSPMR.yaml +0 -12
- dfm_python-0.4.2/config/series/KOCYLEADR.yaml +0 -11
- dfm_python-0.4.2/config/series/KODBLNEQA.yaml +0 -13
- dfm_python-0.4.2/config/series/KODBLNHSA.yaml +0 -13
- dfm_python-0.4.2/config/series/KOEMPCONF.yaml +0 -13
- dfm_python-0.4.2/config/series/KOEMPMANF.yaml +0 -12
- dfm_python-0.4.2/config/series/KOEMPTOTO.yaml +0 -12
- dfm_python-0.4.2/config/series/KOEMPWREP.yaml +0 -13
- dfm_python-0.4.2/config/series/KOEQUIMAE.yaml +0 -12
- dfm_python-0.4.2/config/series/KOEQUIPTE.yaml +0 -12
- dfm_python-0.4.2/config/series/KOEQUITTE.yaml +0 -12
- dfm_python-0.4.2/config/series/KOEXCHINA.yaml +0 -13
- dfm_python-0.4.2/config/series/KOEXNGS_D.yaml +0 -12
- dfm_python-0.4.2/config/series/KOEXPGDSA.yaml +0 -13
- dfm_python-0.4.2/config/series/KOEXPPRCF.yaml +0 -12
- dfm_python-0.4.2/config/series/KOGCFCNSD.yaml +0 -12
- dfm_python-0.4.2/config/series/KOGCFFNVD.yaml +0 -12
- dfm_python-0.4.2/config/series/KOGDP___D.yaml +0 -12
- dfm_python-0.4.2/config/series/KOGFCF__D.yaml +0 -12
- dfm_python-0.4.2/config/series/KOHWRWEMP.yaml +0 -12
- dfm_python-0.4.2/config/series/KOIMNGS_D.yaml +0 -11
- dfm_python-0.4.2/config/series/KOIMPCONA.yaml +0 -13
- dfm_python-0.4.2/config/series/KOIMPGDDA.yaml +0 -13
- dfm_python-0.4.2/config/series/KOIMPGDSA.yaml +0 -12
- dfm_python-0.4.2/config/series/KOIMPPRCF.yaml +0 -12
- dfm_python-0.4.2/config/series/KOIPALL_G.yaml +0 -11
- dfm_python-0.4.2/config/series/KOIPMIMAG.yaml +0 -11
- dfm_python-0.4.2/config/series/KOLRLTCO.yaml +0 -12
- dfm_python-0.4.2/config/series/KOLRLTHH.yaml +0 -11
- dfm_python-0.4.2/config/series/KOMPCAPGG.yaml +0 -12
- dfm_python-0.4.2/config/series/KOMPCONDG.yaml +0 -12
- dfm_python-0.4.2/config/series/KOMPCONGG.yaml +0 -12
- dfm_python-0.4.2/config/series/KOMPCONNG.yaml +0 -12
- dfm_python-0.4.2/config/series/KOMPRI30G.yaml +0 -12
- dfm_python-0.4.2/config/series/KOMSCAPGG.yaml +0 -12
- dfm_python-0.4.2/config/series/KOMSCONGG.yaml +0 -12
- dfm_python-0.4.2/config/series/KONETTRDF.yaml +0 -13
- dfm_python-0.4.2/config/series/KONEWCONA.yaml +0 -13
- dfm_python-0.4.2/config/series/KOPICAPGG.yaml +0 -12
- dfm_python-0.4.2/config/series/KOPICONGG.yaml +0 -12
- dfm_python-0.4.2/config/series/KOPIMANUG.yaml +0 -11
- dfm_python-0.4.2/config/series/KOPOPACTE.yaml +0 -12
- dfm_python-0.4.2/config/series/KOPPSRM_F.yaml +0 -12
- dfm_python-0.4.2/config/series/KOPROPRCF.yaml +0 -12
- dfm_python-0.4.2/config/series/KOPSMANUG.yaml +0 -11
- dfm_python-0.4.2/config/series/KORCNST.yaml +0 -8
- dfm_python-0.4.2/config/series/KORELEC.yaml +0 -11
- dfm_python-0.4.2/config/series/KORFBEV.yaml +0 -11
- dfm_python-0.4.2/config/series/KORMACH.yaml +0 -8
- dfm_python-0.4.2/config/series/KORMCMP.yaml +0 -8
- dfm_python-0.4.2/config/series/KOROCOINF.yaml +0 -11
- dfm_python-0.4.2/config/series/KORWHLS.yaml +0 -11
- dfm_python-0.4.2/config/series/KOSHRPRCF.yaml +0 -12
- dfm_python-0.4.2/config/series/KOSIAHOTE.yaml +0 -12
- dfm_python-0.4.2/config/series/KOSIAI__E.yaml +0 -12
- dfm_python-0.4.2/config/series/KOSIARRLE.yaml +0 -11
- dfm_python-0.4.2/config/series/KOSIAWRTE.yaml +0 -12
- dfm_python-0.4.2/config/series/KOSSBFMBE.yaml +0 -11
- dfm_python-0.4.2/config/series/KOUN_TOTQ.yaml +0 -12
- dfm_python-0.4.2/config/series/KOUS____.yaml +0 -13
- dfm_python-0.4.2/config/series/KOVALCONA.yaml +0 -13
- dfm_python-0.4.2/config/series/KOWRCCNSE.yaml +0 -12
- dfm_python-0.4.2/config/series/KOWRCDURE.yaml +0 -12
- dfm_python-0.4.2/config/series/KOWRCNODE.yaml +0 -12
- dfm_python-0.4.2/config/series/KOWRCSEME.yaml +0 -12
- dfm_python-0.4.2/src/dfm_python/data/__init__.py +0 -52
- dfm_python-0.4.2/src/dfm_python/data/transformation.py +0 -313
- dfm_python-0.4.2/src/dfm_python/lightning/__init__.py +0 -50
- dfm_python-0.4.2/src/dfm_python/lightning/callbacks.py +0 -0
- dfm_python-0.4.2/src/dfm_python/lightning/data_module.py +0 -558
- dfm_python-0.4.2/src/dfm_python/lightning/ddfm_module.py +0 -580
- dfm_python-0.4.2/src/dfm_python/lightning/dfm_module.py +0 -466
- dfm_python-0.4.2/src/dfm_python/lightning/utils.py +0 -0
- dfm_python-0.4.2/src/dfm_python/models/base.py +0 -235
- dfm_python-0.4.2/src/dfm_python/models/ddfm.py +0 -1594
- dfm_python-0.4.2/src/dfm_python/models/estimation.py +0 -372
- dfm_python-0.4.2/src/dfm_python/nowcast/__init__.py +0 -28
- {dfm_python-0.4.2 → dfm_python-0.4.5}/.gitignore +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/.python-version +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/LICENSE +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/MANIFEST.in +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/data/metadata.csv +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/data/sample_data.csv +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/data/dataset.py +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/encoder/__init__.py +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/encoder/base.py +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/encoder/pca.py +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/logger/__init__.py +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/logger/inference_logger.py +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/logger/logger.py +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/logger/train_logger.py +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/ssm/__init__.py +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/dfm_python/ssm/em.py +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/test/test_config.py +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/test/test_logger.py +0 -0
- {dfm_python-0.4.2 → dfm_python-0.4.5}/src/test/test_ssm.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dfm-python
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.5
|
|
4
4
|
Summary: Dynamic Factor Model (DFM) estimation and nowcasting in Python
|
|
5
5
|
Project-URL: Homepage, https://github.com/yourusername/dfm-python
|
|
6
6
|
Project-URL: Documentation, https://github.com/yourusername/dfm-python#readme
|
|
@@ -22,7 +22,7 @@ Requires-Python: >=3.10
|
|
|
22
22
|
Requires-Dist: hydra-core>=1.3.2
|
|
23
23
|
Requires-Dist: matplotlib>=3.5.0
|
|
24
24
|
Requires-Dist: numpy>=1.24.0
|
|
25
|
-
Requires-Dist:
|
|
25
|
+
Requires-Dist: pandas>=2.0.0
|
|
26
26
|
Requires-Dist: pyarrow>=22.0.0
|
|
27
27
|
Requires-Dist: pytorch-lightning>=2.0.0
|
|
28
28
|
Requires-Dist: scikit-learn>=1.7.2
|
|
@@ -45,6 +45,8 @@ Provides-Extra: dev
|
|
|
45
45
|
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
46
46
|
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
47
47
|
Requires-Dist: scikit-learn>=1.0.0; extra == 'dev'
|
|
48
|
+
Provides-Extra: forecasting
|
|
49
|
+
Requires-Dist: sktime[forecasting]>=0.40.1; extra == 'forecasting'
|
|
48
50
|
Provides-Extra: hydra
|
|
49
51
|
Requires-Dist: hydra-core>=1.3.0; extra == 'hydra'
|
|
50
52
|
Requires-Dist: omegaconf>=2.3.0; extra == 'hydra'
|
|
@@ -78,7 +80,7 @@ A Dynamic Factor Model is a powerful statistical framework that:
|
|
|
78
80
|
- ✅ **Clock-based framework**: All factors evolve at a common clock frequency (configurable: daily, weekly, monthly, quarterly, semi-annual, annual)
|
|
79
81
|
- ✅ **Block structure**: Flexible factor organization (global common factor + sector-specific factors)
|
|
80
82
|
- ✅ **Idiosyncratic components**: Per-series state augmentation for better fit (AR(1) for clock-frequency, tent-length chains for slower frequencies)
|
|
81
|
-
- ✅ **
|
|
83
|
+
- ✅ **Preprocessed data**: Package expects preprocessed data from users - users handle all preprocessing (imputation, scaling, feature engineering) using sktime or other tools
|
|
82
84
|
- ✅ **News decomposition**: Attribute forecast changes to specific data releases
|
|
83
85
|
- ✅ **Nowcasting & Forecasting**: Generate predictions for any horizon
|
|
84
86
|
- ✅ **Deep Dynamic Factor Models (DDFM)**: Nonlinear encoder with PyTorch for capturing complex factor structures (optional, requires `dfm-python[deep]`)
|
|
@@ -103,7 +105,7 @@ pip install dfm-python
|
|
|
103
105
|
**Requirements**:
|
|
104
106
|
- Python >= 3.10
|
|
105
107
|
- numpy >= 1.24.0
|
|
106
|
-
-
|
|
108
|
+
- pandas >= 2.0.0
|
|
107
109
|
- scipy >= 1.10.0
|
|
108
110
|
|
|
109
111
|
Optional dependencies:
|
|
@@ -119,7 +121,7 @@ Optional dependencies:
|
|
|
119
121
|
import dfm_python as dfm
|
|
120
122
|
import numpy as np
|
|
121
123
|
from datetime import datetime
|
|
122
|
-
import
|
|
124
|
+
import pandas as pd
|
|
123
125
|
|
|
124
126
|
# Generate or load your data (T × N: time periods × series)
|
|
125
127
|
# Data should be standardized or will be standardized automatically
|
|
@@ -215,36 +217,25 @@ dfm.train(max_iter=5000, threshold=1e-5)
|
|
|
215
217
|
X_forecast, Z_forecast = dfm.predict(horizon=None) # Or specify: horizon=12
|
|
216
218
|
```
|
|
217
219
|
|
|
218
|
-
### Example 3: Using
|
|
220
|
+
### Example 3: Using YAML Configuration (Recommended)
|
|
219
221
|
|
|
220
222
|
```python
|
|
221
223
|
import dfm_python as dfm
|
|
222
|
-
from dfm_python.config import Params
|
|
223
|
-
import polars as pl
|
|
224
|
-
|
|
225
|
-
# 1. Create spec CSV (see Data Format section)
|
|
226
|
-
# 2. Load configuration
|
|
227
|
-
params = Params(
|
|
228
|
-
max_iter=5000,
|
|
229
|
-
threshold=1e-5,
|
|
230
|
-
clock='m',
|
|
231
|
-
augment_idio=True, # Enable idio components
|
|
232
|
-
idio_rho0=0.1 # Initial AR coefficient for idio
|
|
233
|
-
)
|
|
234
|
-
spec_df = pl.read_csv('data/spec.csv')
|
|
235
|
-
dfm.from_spec_df(spec_df, params=params)
|
|
236
224
|
|
|
237
|
-
#
|
|
225
|
+
# 1. Load configuration from YAML file
|
|
226
|
+
dfm.from_yaml('config/default.yaml')
|
|
227
|
+
|
|
228
|
+
# 2. Load data
|
|
238
229
|
dfm.load_data('data/data.csv', sample_start='2020-01-01', sample_end='2023-12-31')
|
|
239
230
|
|
|
240
|
-
#
|
|
231
|
+
# 3. Train
|
|
241
232
|
dfm.train()
|
|
242
233
|
|
|
243
|
-
#
|
|
234
|
+
# 4. Forecast and visualize (horizon=None defaults to 1 year of periods)
|
|
244
235
|
X_forecast, Z_forecast = dfm.predict(horizon=None) # Or specify: horizon=12
|
|
245
236
|
dfm.plot(kind='factor', factor_index=0, forecast_horizon=None, save_path='factor_forecast.png')
|
|
246
237
|
|
|
247
|
-
#
|
|
238
|
+
# 5. Access results
|
|
248
239
|
result = dfm.get_result()
|
|
249
240
|
print(f"Converged: {result.converged}, Iterations: {result.num_iter}")
|
|
250
241
|
print(f"Log-likelihood: {result.loglik:.2f}")
|
|
@@ -297,28 +288,7 @@ decomposition abilities (which require the data view).
|
|
|
297
288
|
|
|
298
289
|
The package supports multiple ways to configure your model:
|
|
299
290
|
|
|
300
|
-
#### 1.
|
|
301
|
-
|
|
302
|
-
**Best for**: Users with existing CSV files and Excel-based workflows
|
|
303
|
-
|
|
304
|
-
```python
|
|
305
|
-
from dfm_python.config import Params
|
|
306
|
-
import polars as pl
|
|
307
|
-
|
|
308
|
-
params = Params(
|
|
309
|
-
max_iter=5000,
|
|
310
|
-
threshold=1e-5,
|
|
311
|
-
clock='m',
|
|
312
|
-
augment_idio=True,
|
|
313
|
-
augment_idio_slow=True,
|
|
314
|
-
idio_rho0=0.1,
|
|
315
|
-
idio_min_var=1e-8
|
|
316
|
-
)
|
|
317
|
-
spec_df = pl.read_csv('data/spec.csv')
|
|
318
|
-
dfm.from_spec_df(spec_df, params=params)
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
#### 2. YAML Configuration
|
|
291
|
+
#### 1. YAML Configuration
|
|
322
292
|
|
|
323
293
|
**Best for**: Users who prefer declarative configuration files
|
|
324
294
|
|
|
@@ -331,7 +301,7 @@ dfm.load_data('data/sample_data.csv')
|
|
|
331
301
|
dfm.train()
|
|
332
302
|
```
|
|
333
303
|
|
|
334
|
-
####
|
|
304
|
+
#### 2. Hydra Decorator (Advanced)
|
|
335
305
|
|
|
336
306
|
**Best for**: Users already using Hydra for configuration management
|
|
337
307
|
|
|
@@ -356,7 +326,7 @@ if __name__ == "__main__":
|
|
|
356
326
|
|
|
357
327
|
**CLI Overrides**: `python script.py max_iter=10 threshold=1e-4 blocks.Block_Global.factors=2`
|
|
358
328
|
|
|
359
|
-
####
|
|
329
|
+
#### 3. Direct Python Objects
|
|
360
330
|
|
|
361
331
|
**Best for**: Programmatic configuration and integration with other Python code
|
|
362
332
|
|
|
@@ -459,7 +429,7 @@ Date,gdp_real,consumption,investment,employment,retail_sales
|
|
|
459
429
|
**Notes**:
|
|
460
430
|
- Quarterly series (e.g., `gdp_real`) only have values at quarter-end months
|
|
461
431
|
- Monthly series (e.g., `employment`, `retail_sales`) have values every month
|
|
462
|
-
-
|
|
432
|
+
- **Data must be preprocessed**: Users must handle missing values, scaling, and feature engineering before passing data to the package. Use sktime or other tools for preprocessing.
|
|
463
433
|
|
|
464
434
|
### Supported Frequencies
|
|
465
435
|
|
|
@@ -856,11 +826,9 @@ config = DFMConfig(series=series, blocks=blocks)
|
|
|
856
826
|
|
|
857
827
|
```python
|
|
858
828
|
import dfm_python as dfm
|
|
859
|
-
import
|
|
829
|
+
import pandas as pd
|
|
860
830
|
|
|
861
831
|
# Configuration
|
|
862
|
-
spec_df = pl.read_csv(spec_path)
|
|
863
|
-
dfm.from_spec_df(spec_df, params=None) # Convert spec DataFrame to YAML + load
|
|
864
832
|
dfm.from_yaml(yaml_path) # Load from YAML file
|
|
865
833
|
dfm.from_dict(config_dict) # Load from dictionary
|
|
866
834
|
dfm.load_config(hydra=cfg) # Load from Hydra DictConfig
|
|
@@ -1141,13 +1109,6 @@ python tutorial/basic_tutorial.py \
|
|
|
1141
1109
|
--config-name default \
|
|
1142
1110
|
data_path=data/sample_data.csv
|
|
1143
1111
|
|
|
1144
|
-
# Convert spec CSV to YAML first, then use
|
|
1145
|
-
python -c "import dfm_python as dfm; dfm.from_spec('data/sample_spec.csv')"
|
|
1146
|
-
python tutorial/basic_tutorial.py \
|
|
1147
|
-
--config-path config \
|
|
1148
|
-
--config-name sample_spec \
|
|
1149
|
-
data_path=data/sample_data.csv
|
|
1150
|
-
|
|
1151
1112
|
# With CLI overrides
|
|
1152
1113
|
python tutorial/basic_tutorial.py \
|
|
1153
1114
|
--config-path config \
|
|
@@ -1160,7 +1121,6 @@ python tutorial/basic_tutorial.py \
|
|
|
1160
1121
|
|
|
1161
1122
|
Comprehensive tutorial covering:
|
|
1162
1123
|
- **Hydra-based configuration**: All configs managed through YAML files
|
|
1163
|
-
- **Spec CSV conversion**: Convert CSV to YAML using `dfm.from_spec()`, then load via Hydra
|
|
1164
1124
|
- **CLI parameter overrides**: Override any parameter via command line
|
|
1165
1125
|
- **Data preparation and transformation**
|
|
1166
1126
|
- **Model training and convergence**
|
|
@@ -1223,14 +1183,14 @@ DATA_VIEW_SOURCE=file # or database
|
|
|
1223
1183
|
|
|
1224
1184
|
### Recent Improvements (v0.3.1)
|
|
1225
1185
|
|
|
1226
|
-
- ✅ **
|
|
1227
|
-
`create_data_view()` now applies release-date masks via
|
|
1186
|
+
- ✅ **Pandas-backed Data Views + Kalman Cache**
|
|
1187
|
+
`create_data_view()` now applies release-date masks via pandas, avoiding per-view NumPy copies. `Nowcast.backtest()` reuses cached Kalman filter/smoother states across successive data views, giving large speed-ups for 12-step pseudo real-time tests.
|
|
1228
1188
|
- ✅ **Backtest Trajectory Plot**
|
|
1229
1189
|
`BacktestResult.plot_trajectory()` draws 이전 vs. 업데이트 nowcast curves plus monthly actuals along a relative week axis (`-12주 … 현재`). The tutorial simply calls this helper—no more hand-built plotting code.
|
|
1230
1190
|
- ✅ **Higher-Frequency Backsteps**
|
|
1231
1191
|
`Nowcast.backtest(..., backward_steps=12, higher_freq=True)` now emits weekly snapshots even when the model clock is monthly, so you can inspect 12주 worth of “pseudo releases” immediately.
|
|
1232
1192
|
- ✅ **Reload & Reuse**
|
|
1233
|
-
`DFM.load_pickle()` restores config, time index, and cached
|
|
1193
|
+
`DFM.load_pickle()` restores config, time index, and cached pandas data views so you can call `predict()`/`nowcast()` right after loading without re-reading CSVs.
|
|
1234
1194
|
- ✅ **API + Docs Refresh**
|
|
1235
1195
|
README/tutorial sections now highlight the faster backtests, new trajectory plots, and guidelines for interpreting flattened Q-matrix values or “strange” news decomposition outputs.
|
|
1236
1196
|
|
|
@@ -1244,7 +1204,7 @@ DATA_VIEW_SOURCE=file # or database
|
|
|
1244
1204
|
- ✅ **Model Result Storage**: File-based and SQLite adapters for saving/loading model results
|
|
1245
1205
|
- ✅ **Data View Management**: Time-point specific data views for pseudo real-time evaluation
|
|
1246
1206
|
- ✅ **Helper Function Consolidation**: Reduced code duplication with consolidated helper functions
|
|
1247
|
-
- `to_python_datetime()`: Generic datetime conversion (handles
|
|
1207
|
+
- `to_python_datetime()`: Generic datetime conversion (handles pandas Timestamp, strings, etc.)
|
|
1248
1208
|
- `extract_last_date()`: Generic time index extraction
|
|
1249
1209
|
- `clock_to_datetime_freq()`: Shared clock-to-datetime frequency mapping
|
|
1250
1210
|
- `get_periods_per_year()`: Generic periods-per-year calculation
|
|
@@ -24,7 +24,7 @@ A Dynamic Factor Model is a powerful statistical framework that:
|
|
|
24
24
|
- ✅ **Clock-based framework**: All factors evolve at a common clock frequency (configurable: daily, weekly, monthly, quarterly, semi-annual, annual)
|
|
25
25
|
- ✅ **Block structure**: Flexible factor organization (global common factor + sector-specific factors)
|
|
26
26
|
- ✅ **Idiosyncratic components**: Per-series state augmentation for better fit (AR(1) for clock-frequency, tent-length chains for slower frequencies)
|
|
27
|
-
- ✅ **
|
|
27
|
+
- ✅ **Preprocessed data**: Package expects preprocessed data from users - users handle all preprocessing (imputation, scaling, feature engineering) using sktime or other tools
|
|
28
28
|
- ✅ **News decomposition**: Attribute forecast changes to specific data releases
|
|
29
29
|
- ✅ **Nowcasting & Forecasting**: Generate predictions for any horizon
|
|
30
30
|
- ✅ **Deep Dynamic Factor Models (DDFM)**: Nonlinear encoder with PyTorch for capturing complex factor structures (optional, requires `dfm-python[deep]`)
|
|
@@ -49,7 +49,7 @@ pip install dfm-python
|
|
|
49
49
|
**Requirements**:
|
|
50
50
|
- Python >= 3.10
|
|
51
51
|
- numpy >= 1.24.0
|
|
52
|
-
-
|
|
52
|
+
- pandas >= 2.0.0
|
|
53
53
|
- scipy >= 1.10.0
|
|
54
54
|
|
|
55
55
|
Optional dependencies:
|
|
@@ -65,7 +65,7 @@ Optional dependencies:
|
|
|
65
65
|
import dfm_python as dfm
|
|
66
66
|
import numpy as np
|
|
67
67
|
from datetime import datetime
|
|
68
|
-
import
|
|
68
|
+
import pandas as pd
|
|
69
69
|
|
|
70
70
|
# Generate or load your data (T × N: time periods × series)
|
|
71
71
|
# Data should be standardized or will be standardized automatically
|
|
@@ -161,36 +161,25 @@ dfm.train(max_iter=5000, threshold=1e-5)
|
|
|
161
161
|
X_forecast, Z_forecast = dfm.predict(horizon=None) # Or specify: horizon=12
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
-
### Example 3: Using
|
|
164
|
+
### Example 3: Using YAML Configuration (Recommended)
|
|
165
165
|
|
|
166
166
|
```python
|
|
167
167
|
import dfm_python as dfm
|
|
168
|
-
from dfm_python.config import Params
|
|
169
|
-
import polars as pl
|
|
170
|
-
|
|
171
|
-
# 1. Create spec CSV (see Data Format section)
|
|
172
|
-
# 2. Load configuration
|
|
173
|
-
params = Params(
|
|
174
|
-
max_iter=5000,
|
|
175
|
-
threshold=1e-5,
|
|
176
|
-
clock='m',
|
|
177
|
-
augment_idio=True, # Enable idio components
|
|
178
|
-
idio_rho0=0.1 # Initial AR coefficient for idio
|
|
179
|
-
)
|
|
180
|
-
spec_df = pl.read_csv('data/spec.csv')
|
|
181
|
-
dfm.from_spec_df(spec_df, params=params)
|
|
182
168
|
|
|
183
|
-
#
|
|
169
|
+
# 1. Load configuration from YAML file
|
|
170
|
+
dfm.from_yaml('config/default.yaml')
|
|
171
|
+
|
|
172
|
+
# 2. Load data
|
|
184
173
|
dfm.load_data('data/data.csv', sample_start='2020-01-01', sample_end='2023-12-31')
|
|
185
174
|
|
|
186
|
-
#
|
|
175
|
+
# 3. Train
|
|
187
176
|
dfm.train()
|
|
188
177
|
|
|
189
|
-
#
|
|
178
|
+
# 4. Forecast and visualize (horizon=None defaults to 1 year of periods)
|
|
190
179
|
X_forecast, Z_forecast = dfm.predict(horizon=None) # Or specify: horizon=12
|
|
191
180
|
dfm.plot(kind='factor', factor_index=0, forecast_horizon=None, save_path='factor_forecast.png')
|
|
192
181
|
|
|
193
|
-
#
|
|
182
|
+
# 5. Access results
|
|
194
183
|
result = dfm.get_result()
|
|
195
184
|
print(f"Converged: {result.converged}, Iterations: {result.num_iter}")
|
|
196
185
|
print(f"Log-likelihood: {result.loglik:.2f}")
|
|
@@ -243,28 +232,7 @@ decomposition abilities (which require the data view).
|
|
|
243
232
|
|
|
244
233
|
The package supports multiple ways to configure your model:
|
|
245
234
|
|
|
246
|
-
#### 1.
|
|
247
|
-
|
|
248
|
-
**Best for**: Users with existing CSV files and Excel-based workflows
|
|
249
|
-
|
|
250
|
-
```python
|
|
251
|
-
from dfm_python.config import Params
|
|
252
|
-
import polars as pl
|
|
253
|
-
|
|
254
|
-
params = Params(
|
|
255
|
-
max_iter=5000,
|
|
256
|
-
threshold=1e-5,
|
|
257
|
-
clock='m',
|
|
258
|
-
augment_idio=True,
|
|
259
|
-
augment_idio_slow=True,
|
|
260
|
-
idio_rho0=0.1,
|
|
261
|
-
idio_min_var=1e-8
|
|
262
|
-
)
|
|
263
|
-
spec_df = pl.read_csv('data/spec.csv')
|
|
264
|
-
dfm.from_spec_df(spec_df, params=params)
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
#### 2. YAML Configuration
|
|
235
|
+
#### 1. YAML Configuration
|
|
268
236
|
|
|
269
237
|
**Best for**: Users who prefer declarative configuration files
|
|
270
238
|
|
|
@@ -277,7 +245,7 @@ dfm.load_data('data/sample_data.csv')
|
|
|
277
245
|
dfm.train()
|
|
278
246
|
```
|
|
279
247
|
|
|
280
|
-
####
|
|
248
|
+
#### 2. Hydra Decorator (Advanced)
|
|
281
249
|
|
|
282
250
|
**Best for**: Users already using Hydra for configuration management
|
|
283
251
|
|
|
@@ -302,7 +270,7 @@ if __name__ == "__main__":
|
|
|
302
270
|
|
|
303
271
|
**CLI Overrides**: `python script.py max_iter=10 threshold=1e-4 blocks.Block_Global.factors=2`
|
|
304
272
|
|
|
305
|
-
####
|
|
273
|
+
#### 3. Direct Python Objects
|
|
306
274
|
|
|
307
275
|
**Best for**: Programmatic configuration and integration with other Python code
|
|
308
276
|
|
|
@@ -405,7 +373,7 @@ Date,gdp_real,consumption,investment,employment,retail_sales
|
|
|
405
373
|
**Notes**:
|
|
406
374
|
- Quarterly series (e.g., `gdp_real`) only have values at quarter-end months
|
|
407
375
|
- Monthly series (e.g., `employment`, `retail_sales`) have values every month
|
|
408
|
-
-
|
|
376
|
+
- **Data must be preprocessed**: Users must handle missing values, scaling, and feature engineering before passing data to the package. Use sktime or other tools for preprocessing.
|
|
409
377
|
|
|
410
378
|
### Supported Frequencies
|
|
411
379
|
|
|
@@ -802,11 +770,9 @@ config = DFMConfig(series=series, blocks=blocks)
|
|
|
802
770
|
|
|
803
771
|
```python
|
|
804
772
|
import dfm_python as dfm
|
|
805
|
-
import
|
|
773
|
+
import pandas as pd
|
|
806
774
|
|
|
807
775
|
# Configuration
|
|
808
|
-
spec_df = pl.read_csv(spec_path)
|
|
809
|
-
dfm.from_spec_df(spec_df, params=None) # Convert spec DataFrame to YAML + load
|
|
810
776
|
dfm.from_yaml(yaml_path) # Load from YAML file
|
|
811
777
|
dfm.from_dict(config_dict) # Load from dictionary
|
|
812
778
|
dfm.load_config(hydra=cfg) # Load from Hydra DictConfig
|
|
@@ -1087,13 +1053,6 @@ python tutorial/basic_tutorial.py \
|
|
|
1087
1053
|
--config-name default \
|
|
1088
1054
|
data_path=data/sample_data.csv
|
|
1089
1055
|
|
|
1090
|
-
# Convert spec CSV to YAML first, then use
|
|
1091
|
-
python -c "import dfm_python as dfm; dfm.from_spec('data/sample_spec.csv')"
|
|
1092
|
-
python tutorial/basic_tutorial.py \
|
|
1093
|
-
--config-path config \
|
|
1094
|
-
--config-name sample_spec \
|
|
1095
|
-
data_path=data/sample_data.csv
|
|
1096
|
-
|
|
1097
1056
|
# With CLI overrides
|
|
1098
1057
|
python tutorial/basic_tutorial.py \
|
|
1099
1058
|
--config-path config \
|
|
@@ -1106,7 +1065,6 @@ python tutorial/basic_tutorial.py \
|
|
|
1106
1065
|
|
|
1107
1066
|
Comprehensive tutorial covering:
|
|
1108
1067
|
- **Hydra-based configuration**: All configs managed through YAML files
|
|
1109
|
-
- **Spec CSV conversion**: Convert CSV to YAML using `dfm.from_spec()`, then load via Hydra
|
|
1110
1068
|
- **CLI parameter overrides**: Override any parameter via command line
|
|
1111
1069
|
- **Data preparation and transformation**
|
|
1112
1070
|
- **Model training and convergence**
|
|
@@ -1169,14 +1127,14 @@ DATA_VIEW_SOURCE=file # or database
|
|
|
1169
1127
|
|
|
1170
1128
|
### Recent Improvements (v0.3.1)
|
|
1171
1129
|
|
|
1172
|
-
- ✅ **
|
|
1173
|
-
`create_data_view()` now applies release-date masks via
|
|
1130
|
+
- ✅ **Pandas-backed Data Views + Kalman Cache**
|
|
1131
|
+
`create_data_view()` now applies release-date masks via pandas, avoiding per-view NumPy copies. `Nowcast.backtest()` reuses cached Kalman filter/smoother states across successive data views, giving large speed-ups for 12-step pseudo real-time tests.
|
|
1174
1132
|
- ✅ **Backtest Trajectory Plot**
|
|
1175
1133
|
`BacktestResult.plot_trajectory()` draws 이전 vs. 업데이트 nowcast curves plus monthly actuals along a relative week axis (`-12주 … 현재`). The tutorial simply calls this helper—no more hand-built plotting code.
|
|
1176
1134
|
- ✅ **Higher-Frequency Backsteps**
|
|
1177
1135
|
`Nowcast.backtest(..., backward_steps=12, higher_freq=True)` now emits weekly snapshots even when the model clock is monthly, so you can inspect 12주 worth of “pseudo releases” immediately.
|
|
1178
1136
|
- ✅ **Reload & Reuse**
|
|
1179
|
-
`DFM.load_pickle()` restores config, time index, and cached
|
|
1137
|
+
`DFM.load_pickle()` restores config, time index, and cached pandas data views so you can call `predict()`/`nowcast()` right after loading without re-reading CSVs.
|
|
1180
1138
|
- ✅ **API + Docs Refresh**
|
|
1181
1139
|
README/tutorial sections now highlight the faster backtests, new trajectory plots, and guidelines for interpreting flattened Q-matrix values or “strange” news decomposition outputs.
|
|
1182
1140
|
|
|
@@ -1190,7 +1148,7 @@ DATA_VIEW_SOURCE=file # or database
|
|
|
1190
1148
|
- ✅ **Model Result Storage**: File-based and SQLite adapters for saving/loading model results
|
|
1191
1149
|
- ✅ **Data View Management**: Time-point specific data views for pseudo real-time evaluation
|
|
1192
1150
|
- ✅ **Helper Function Consolidation**: Reduced code duplication with consolidated helper functions
|
|
1193
|
-
- `to_python_datetime()`: Generic datetime conversion (handles
|
|
1151
|
+
- `to_python_datetime()`: Generic datetime conversion (handles pandas Timestamp, strings, etc.)
|
|
1194
1152
|
- `extract_last_date()`: Generic time index extraction
|
|
1195
1153
|
- `clock_to_datetime_freq()`: Shared clock-to-datetime frequency mapping
|
|
1196
1154
|
- `get_periods_per_year()`: Generic periods-per-year calculation
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Configuration Structure
|
|
2
|
+
|
|
3
|
+
This directory contains all configuration files for the Nowcasting system. The configuration follows a **unified structure** where experiment configs contain all necessary settings including preprocessing and series configurations.
|
|
4
|
+
|
|
5
|
+
## Directory Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
config/
|
|
9
|
+
├── experiment/ # Experiment configurations (unified structure)
|
|
10
|
+
├── model/ # Model-specific hyperparameters
|
|
11
|
+
├── preprocess/ # Preprocessing templates (for reference)
|
|
12
|
+
└── series/ # Series configurations (legacy, now embedded in experiments)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Unified Configuration Structure
|
|
16
|
+
|
|
17
|
+
### Experiment Configs (`config/experiment/`)
|
|
18
|
+
|
|
19
|
+
Experiment configs now contain **all** configuration in a single file:
|
|
20
|
+
|
|
21
|
+
```yaml
|
|
22
|
+
# Experiment Metadata
|
|
23
|
+
name: experiment_name
|
|
24
|
+
description: "Experiment description"
|
|
25
|
+
model_type: dfm # dfm, ddfm, arma, tft, xgboost
|
|
26
|
+
|
|
27
|
+
# Preprocess Configuration
|
|
28
|
+
preprocess:
|
|
29
|
+
metadata:
|
|
30
|
+
data_path: data/sample_data.csv
|
|
31
|
+
target_column: KOGDP...D
|
|
32
|
+
exclude_columns: [date]
|
|
33
|
+
sample_start: null
|
|
34
|
+
sample_end: null
|
|
35
|
+
|
|
36
|
+
data_quality:
|
|
37
|
+
remove_sparse_rows: true
|
|
38
|
+
sparse_threshold: 0.8
|
|
39
|
+
clip_outliers: true
|
|
40
|
+
outlier_std: 3.0
|
|
41
|
+
|
|
42
|
+
feature_engineering:
|
|
43
|
+
window_summarizer:
|
|
44
|
+
enabled: true
|
|
45
|
+
lags: [1, 2, 3, 5, 10]
|
|
46
|
+
windows: [5, 10, 20, 40]
|
|
47
|
+
functions: [mean, std, min, max, median, skew, kurt]
|
|
48
|
+
|
|
49
|
+
global_preprocessing:
|
|
50
|
+
imputation:
|
|
51
|
+
method: ffill_bfill # For non-DFM/DDFM models
|
|
52
|
+
scaling:
|
|
53
|
+
enabled: true
|
|
54
|
+
type: robust
|
|
55
|
+
transformations:
|
|
56
|
+
enabled: []
|
|
57
|
+
|
|
58
|
+
# Series Configuration
|
|
59
|
+
series:
|
|
60
|
+
- series_id: KO3YEARC
|
|
61
|
+
frequency: m
|
|
62
|
+
transformation: chg
|
|
63
|
+
blocks: [Block_Global, Block_Investment]
|
|
64
|
+
release: 1
|
|
65
|
+
scaler: null # null = use global scaler
|
|
66
|
+
impute: null # null = use global or Kalman filter (DFM/DDFM)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Key Features
|
|
70
|
+
|
|
71
|
+
1. **Unified Structure**: All experiment settings in one file
|
|
72
|
+
2. **Conditional Imputation**:
|
|
73
|
+
- DFM/DDFM: Uses Kalman filter (built-in, no explicit imputation needed)
|
|
74
|
+
- Other models: Uses explicit imputation (ffill_bfill, mean, median, forecaster)
|
|
75
|
+
3. **Per-Series Overrides**: Each series can override global scaler/impute settings
|
|
76
|
+
4. **Window Summarizer**: Automatic feature engineering with lags and rolling windows
|
|
77
|
+
|
|
78
|
+
## Model Configs (`config/model/`)
|
|
79
|
+
|
|
80
|
+
Model-specific hyperparameters:
|
|
81
|
+
- `dfm.yaml` - DFM model parameters
|
|
82
|
+
- `ddfm.yaml` - DDFM model parameters
|
|
83
|
+
- `arma.yaml` - ARMA model parameters
|
|
84
|
+
- `tft.yaml` - Temporal Fusion Transformer parameters
|
|
85
|
+
- `xgboost.yaml` - XGBoost parameters
|
|
86
|
+
|
|
87
|
+
## Preprocess Configs (`config/preprocess/`)
|
|
88
|
+
|
|
89
|
+
**Note**: These are now templates/reference files. In the new structure, preprocessing is embedded in experiment configs. These files are kept for:
|
|
90
|
+
- Reference and documentation
|
|
91
|
+
- Backward compatibility
|
|
92
|
+
- Template generation
|
|
93
|
+
|
|
94
|
+
## Series Configs (`config/series/`)
|
|
95
|
+
|
|
96
|
+
**Note**: These are legacy files. In the new structure, series configurations are embedded in experiment configs. These files are kept for:
|
|
97
|
+
- Reference
|
|
98
|
+
- Migration purposes
|
|
99
|
+
- Template generation
|
|
100
|
+
|
|
101
|
+
## Configuration Hierarchy
|
|
102
|
+
|
|
103
|
+
1. **Experiment Config** (primary) - Contains all settings
|
|
104
|
+
2. **Model Config** (referenced) - Model-specific hyperparameters
|
|
105
|
+
3. **Preprocess Config** (legacy) - Reference templates only
|
|
106
|
+
4. **Series Config** (legacy) - Reference templates only
|
|
107
|
+
|
|
108
|
+
## Migration Guide
|
|
109
|
+
|
|
110
|
+
### Old Structure
|
|
111
|
+
```yaml
|
|
112
|
+
# experiment/{id}.yaml
|
|
113
|
+
data:
|
|
114
|
+
path: data/sample_data.csv
|
|
115
|
+
preprocessing:
|
|
116
|
+
config_path: config/preprocess/{id}.yaml
|
|
117
|
+
series: [KO3YEARC, ...]
|
|
118
|
+
|
|
119
|
+
# preprocess/{id}.yaml (separate file)
|
|
120
|
+
imputation:
|
|
121
|
+
method: ffill_bfill
|
|
122
|
+
scaling:
|
|
123
|
+
type: robust
|
|
124
|
+
|
|
125
|
+
# series/{series_id}.yaml (separate files)
|
|
126
|
+
frequency: m
|
|
127
|
+
transformation: chg
|
|
128
|
+
blocks: [Block_Global]
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### New Structure
|
|
132
|
+
```yaml
|
|
133
|
+
# experiment/{id}.yaml (unified)
|
|
134
|
+
preprocess:
|
|
135
|
+
global_preprocessing:
|
|
136
|
+
imputation:
|
|
137
|
+
method: ffill_bfill
|
|
138
|
+
scaling:
|
|
139
|
+
type: robust
|
|
140
|
+
series:
|
|
141
|
+
- series_id: KO3YEARC
|
|
142
|
+
frequency: m
|
|
143
|
+
transformation: chg
|
|
144
|
+
blocks: [Block_Global]
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Best Practices
|
|
148
|
+
|
|
149
|
+
1. **Use Experiment Configs**: All new experiments should use the unified structure
|
|
150
|
+
2. **Model Type Awareness**:
|
|
151
|
+
- DFM/DDFM: Imputation handled by Kalman filter
|
|
152
|
+
- Other models: Specify explicit imputation method
|
|
153
|
+
3. **Per-Series Overrides**: Use sparingly, prefer global settings
|
|
154
|
+
4. **Window Summarizer**: Enable for feature-rich models (XGBoost, TFT)
|
|
155
|
+
5. **Scaling**: Use RobustScaler for economic data with outliers
|
|
156
|
+
|
|
157
|
+
## UI Integration
|
|
158
|
+
|
|
159
|
+
The UI left sidebar displays the config tree:
|
|
160
|
+
```
|
|
161
|
+
Experiment
|
|
162
|
+
├── Name, Model Type, Description
|
|
163
|
+
├── Preprocess
|
|
164
|
+
│ ├── Metadata (data path, target, exclude columns)
|
|
165
|
+
│ ├── Data Quality
|
|
166
|
+
│ ├── Feature Engineering (Window Summarizer)
|
|
167
|
+
│ └── Global Preprocessing (imputation, scaling)
|
|
168
|
+
└── Series
|
|
169
|
+
├── KO3YEARC (frequency, transformation, blocks, release, scaler, impute)
|
|
170
|
+
└── [Other series...]
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Right side: Training progress and monitoring.
|
|
174
|
+
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Default Experiment Configuration
|
|
2
|
+
# Unified experiment config with embedded preprocessing and series configurations
|
|
3
|
+
|
|
4
|
+
# Hydra defaults - specify which model config to use
|
|
5
|
+
defaults:
|
|
6
|
+
- model: dfm # Options: dfm, ddfm, arma, tft, xgboost
|
|
7
|
+
- _self_
|
|
8
|
+
|
|
9
|
+
# ============================================================================
|
|
10
|
+
# Experiment Metadata
|
|
11
|
+
# ============================================================================
|
|
12
|
+
name: default_experiment
|
|
13
|
+
description: "Default experiment configuration template"
|
|
14
|
+
model_type: dfm # dfm, ddfm, arma, tft, xgboost
|
|
15
|
+
|
|
16
|
+
# ============================================================================
|
|
17
|
+
# Preprocess Configuration
|
|
18
|
+
# ============================================================================
|
|
19
|
+
preprocess:
|
|
20
|
+
# Metadata
|
|
21
|
+
metadata:
|
|
22
|
+
data_path: data/sample_data.csv # Path to input data file
|
|
23
|
+
target_column: null # Target series for nowcasting/forecasting (e.g., KOGDP...D)
|
|
24
|
+
# Window Summarizer features (add_feature)
|
|
25
|
+
add_feature: # Features to add via Window Summarizer
|
|
26
|
+
- lag # Lag features
|
|
27
|
+
- mean # Rolling mean
|
|
28
|
+
- std # Rolling standard deviation
|
|
29
|
+
- min # Rolling minimum
|
|
30
|
+
- max # Rolling maximum
|
|
31
|
+
- median # Rolling median
|
|
32
|
+
- skew # Rolling skewness
|
|
33
|
+
- kurt # Rolling kurtosis
|
|
34
|
+
# Window Summarizer parameters
|
|
35
|
+
lags: [1, 2, 3, 5, 10] # Lag values: t-1, t-2, t-3, t-5, t-10
|
|
36
|
+
windows: [5, 10, 20, 40] # Rolling window sizes
|
|
37
|
+
|
|
38
|
+
# Series Configuration
|
|
39
|
+
# All series with their individual configurations
|
|
40
|
+
series:
|
|
41
|
+
# If empty, uses all columns from data (except excluded columns)
|
|
42
|
+
# Example series configurations:
|
|
43
|
+
# - series_id: KO3YEARC
|
|
44
|
+
# frequency: m # Options: d, w, m, q, sa, a
|
|
45
|
+
# transformation: chg # Options: lin, pch, pca, chg, ch1, cha
|
|
46
|
+
# block: # Block names this series loads on (must include Block_Global)
|
|
47
|
+
# - Block_Global
|
|
48
|
+
# - Block_Investment
|
|
49
|
+
# release: 1 # Day of month when data is released (1-31, or negative for days before month end)
|
|
50
|
+
# scaler: null # Per-series scaler (StandardScaler, RobustScaler, None/null)
|
|
51
|
+
# # null = use default (ffill and bfill for non-DFM/DDFM, Kalman filter for DFM/DDFM)
|
|
52
|
+
# impute: null # Per-series imputation (bfill, ffill, forecaster, dfm, ddfm)
|
|
53
|
+
# # bfill/ffill: Backward/forward fill
|
|
54
|
+
# # forecaster: Forecaster-based imputation
|
|
55
|
+
# # dfm/ddfm: Use model's built-in Kalman filter imputation (on the fly)
|
|
56
|
+
# # null: Use default (ffill and bfill for non-DFM/DDFM, Kalman filter for DFM/DDFM)
|
|
57
|
+
|
|
58
|
+
# ============================================================================
|
|
59
|
+
# Model Training Parameters
|
|
60
|
+
# ============================================================================
|
|
61
|
+
# These override model config defaults if specified
|
|
62
|
+
max_iter: 5000 # Maximum EM iterations (for DFM)
|
|
63
|
+
threshold: 1.0e-05 # Convergence threshold (for DFM)
|
|
64
|
+
|
|
65
|
+
# For DDFM models:
|
|
66
|
+
# encoder_layers: [64, 32]
|
|
67
|
+
# num_factors: 2
|
|
68
|
+
# epochs: 100
|
|
69
|
+
# learning_rate: 0.001
|
|
70
|
+
# batch_size: 32
|
|
71
|
+
|
|
72
|
+
# ============================================================================
|
|
73
|
+
# Output Configuration
|
|
74
|
+
# ============================================================================
|
|
75
|
+
output:
|
|
76
|
+
path: outputs/${experiment.name} # Output directory (uses experiment name)
|
|
77
|
+
save_model: true # Save trained model
|
|
78
|
+
save_plots: true # Save visualization plots
|
|
79
|
+
save_results: true # Save training results
|
|
80
|
+
|
|
81
|
+
# Forecast configuration (optional)
|
|
82
|
+
forecast_horizon: null # Number of periods ahead to forecast
|