dfm-python 0.2.8__py3-none-any.whl → 0.3.0__py3-none-any.whl
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/__init__.py +13 -34
- dfm_python/api.py +736 -85
- dfm_python/config.py +17 -83
- dfm_python/config_sources.py +426 -98
- dfm_python/core/diagnostics.py +39 -30
- dfm_python/core/em.py +72 -52
- dfm_python/core/helpers.py +345 -6
- dfm_python/core/numeric.py +2 -2
- dfm_python/core/time.py +775 -0
- dfm_python/{utils.py → core/utils.py} +70 -8
- dfm_python/data.py +257 -103
- dfm_python/dfm.py +71 -26
- dfm_python/nowcast.py +1519 -0
- {dfm_python-0.2.8.dist-info → dfm_python-0.3.0.dist-info}/METADATA +426 -58
- dfm_python-0.3.0.dist-info/RECORD +19 -0
- dfm_python/news.py +0 -782
- dfm_python-0.2.8.dist-info/RECORD +0 -18
- {dfm_python-0.2.8.dist-info → dfm_python-0.3.0.dist-info}/WHEEL +0 -0
- {dfm_python-0.2.8.dist-info → dfm_python-0.3.0.dist-info}/licenses/LICENSE +0 -0
dfm_python/__init__.py
CHANGED
|
@@ -50,30 +50,25 @@ Example (Low-level API - For advanced usage):
|
|
|
50
50
|
For detailed documentation, see the README.md file and the tutorial notebooks/scripts.
|
|
51
51
|
"""
|
|
52
52
|
|
|
53
|
-
__version__ = "0.
|
|
53
|
+
__version__ = "0.3.0"
|
|
54
54
|
|
|
55
|
-
from .config import DFMConfig, SeriesConfig, BlockConfig, Params, DEFAULT_GLOBAL_BLOCK_NAME
|
|
56
55
|
from .config import (
|
|
57
|
-
|
|
58
|
-
YamlSource,
|
|
59
|
-
|
|
60
|
-
SpecCSVSource,
|
|
61
|
-
HydraSource,
|
|
62
|
-
MergedConfigSource,
|
|
63
|
-
make_config_source,
|
|
56
|
+
DFMConfig, SeriesConfig, BlockConfig, Params, DEFAULT_GLOBAL_BLOCK_NAME,
|
|
57
|
+
ConfigSource, YamlSource, DictSource, HydraSource,
|
|
58
|
+
MergedConfigSource, make_config_source,
|
|
64
59
|
)
|
|
65
60
|
from .data import transform_data
|
|
66
61
|
from .dfm import DFMResult
|
|
67
62
|
from .core import calculate_rmse, diagnose_series, print_series_diagnosis
|
|
68
|
-
from .dfm import
|
|
63
|
+
from .dfm import DFMCore # Core DFM class from dfm.py
|
|
69
64
|
from .kalman import run_kf, skf, fis, miss_data
|
|
70
|
-
from .
|
|
65
|
+
from .nowcast import Nowcast, para_const, NowcastResult, NewsDecompResult, BacktestResult
|
|
71
66
|
|
|
72
67
|
# Import high-level API (extends core DFM with convenience methods)
|
|
73
68
|
# Import module-level convenience functions directly from api.py to avoid duplication
|
|
74
69
|
from .api import (
|
|
75
70
|
DFM, _dfm_instance, from_yaml, from_spec, from_spec_df, from_dict,
|
|
76
|
-
load_config, load_data, train, predict, plot, reset
|
|
71
|
+
load_config, load_data, load_pickle, train, predict, plot, reset
|
|
77
72
|
)
|
|
78
73
|
|
|
79
74
|
# Expose properties as module-level attributes
|
|
@@ -100,35 +95,19 @@ def get_original_data():
|
|
|
100
95
|
"""Get original (untransformed) data matrix."""
|
|
101
96
|
return _dfm_instance.original_data
|
|
102
97
|
|
|
103
|
-
# For direct attribute access, we'll use __getattr__ but handle config module conflict
|
|
104
|
-
|
|
105
|
-
def __getattr__(name):
|
|
106
|
-
"""Allow access to DFM instance properties at module level."""
|
|
107
|
-
# Handle special cases that conflict with submodules
|
|
108
|
-
if name == 'config' and _dfm_instance.config is not None:
|
|
109
|
-
return _dfm_instance.config
|
|
110
|
-
elif name == 'data':
|
|
111
|
-
return _dfm_instance.data
|
|
112
|
-
elif name == 'time':
|
|
113
|
-
return _dfm_instance.time
|
|
114
|
-
elif name == 'result':
|
|
115
|
-
return _dfm_instance.result
|
|
116
|
-
elif name == 'original_data':
|
|
117
|
-
return _dfm_instance.original_data
|
|
118
|
-
# For other attributes, try normal import
|
|
119
|
-
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
|
|
120
|
-
|
|
121
98
|
__all__ = [
|
|
122
99
|
# Core classes
|
|
123
|
-
'DFMConfig', 'SeriesConfig', 'BlockConfig', 'Params', 'DFM',
|
|
100
|
+
'DFMConfig', 'SeriesConfig', 'BlockConfig', 'Params', 'DFM', 'DFMCore', 'Nowcast',
|
|
101
|
+
# Nowcast result classes
|
|
102
|
+
'NowcastResult', 'NewsDecompResult', 'BacktestResult',
|
|
124
103
|
# Constants
|
|
125
104
|
'DEFAULT_GLOBAL_BLOCK_NAME',
|
|
126
105
|
# Config sources
|
|
127
|
-
'ConfigSource', 'YamlSource', 'DictSource', '
|
|
106
|
+
'ConfigSource', 'YamlSource', 'DictSource', 'HydraSource',
|
|
128
107
|
'MergedConfigSource', 'make_config_source',
|
|
129
108
|
# High-level API (module-level - recommended)
|
|
130
109
|
'load_config',
|
|
131
|
-
'load_data', 'train', 'predict', 'plot', 'reset',
|
|
110
|
+
'load_data', 'load_pickle', 'train', 'predict', 'plot', 'reset',
|
|
132
111
|
'get_config', 'get_data', 'get_time', 'get_result', 'get_original_data',
|
|
133
112
|
# Convenience constructors (cleaner API)
|
|
134
113
|
'from_yaml', 'from_spec', 'from_spec_df', 'from_dict',
|
|
@@ -136,6 +115,6 @@ __all__ = [
|
|
|
136
115
|
'transform_data',
|
|
137
116
|
'DFMResult', 'calculate_rmse', 'diagnose_series', 'print_series_diagnosis',
|
|
138
117
|
'run_kf', 'skf', 'fis', 'miss_data',
|
|
139
|
-
'
|
|
118
|
+
'para_const', # Internal utility, kept for backward compatibility
|
|
140
119
|
]
|
|
141
120
|
|