echoss-timeseries 1.0.0__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.
Files changed (32) hide show
  1. echoss_timeseries-1.0.0/LICENSE +204 -0
  2. echoss_timeseries-1.0.0/MANIFEST.in +6 -0
  3. echoss_timeseries-1.0.0/PKG-INFO +263 -0
  4. echoss_timeseries-1.0.0/README.md +231 -0
  5. echoss_timeseries-1.0.0/echoss_timeseries/__init__.py +110 -0
  6. echoss_timeseries-1.0.0/echoss_timeseries/autoregressive_features.py +677 -0
  7. echoss_timeseries-1.0.0/echoss_timeseries/cache_manager.py +117 -0
  8. echoss_timeseries-1.0.0/echoss_timeseries/decomposition.py +521 -0
  9. echoss_timeseries-1.0.0/echoss_timeseries/echoss_plot_bokeh.py +713 -0
  10. echoss_timeseries-1.0.0/echoss_timeseries/echoss_plot_matplot.py +263 -0
  11. echoss_timeseries-1.0.0/echoss_timeseries/echoss_tsdata.py +1249 -0
  12. echoss_timeseries-1.0.0/echoss_timeseries/echoss_tsmodel.py +581 -0
  13. echoss_timeseries-1.0.0/echoss_timeseries/engines/__init__.py +8 -0
  14. echoss_timeseries-1.0.0/echoss_timeseries/engines/darts_series.py +148 -0
  15. echoss_timeseries-1.0.0/echoss_timeseries/engines/ensemble_base.py +131 -0
  16. echoss_timeseries-1.0.0/echoss_timeseries/engines/holdout_comparison.py +168 -0
  17. echoss_timeseries-1.0.0/echoss_timeseries/engines/model_base.py +89 -0
  18. echoss_timeseries-1.0.0/echoss_timeseries/engines/registry.py +98 -0
  19. echoss_timeseries-1.0.0/echoss_timeseries/engines/screener_base.py +74 -0
  20. echoss_timeseries-1.0.0/echoss_timeseries/engines/sklearn_tabular.py +123 -0
  21. echoss_timeseries-1.0.0/echoss_timeseries/engines/statsmodels_arima.py +85 -0
  22. echoss_timeseries-1.0.0/echoss_timeseries/event_day_features.py +111 -0
  23. echoss_timeseries-1.0.0/echoss_timeseries/outlier.py +173 -0
  24. echoss_timeseries-1.0.0/echoss_timeseries/temporal_features.py +284 -0
  25. echoss_timeseries-1.0.0/echoss_timeseries/tsdiag.py +457 -0
  26. echoss_timeseries-1.0.0/echoss_timeseries.egg-info/PKG-INFO +263 -0
  27. echoss_timeseries-1.0.0/echoss_timeseries.egg-info/SOURCES.txt +30 -0
  28. echoss_timeseries-1.0.0/echoss_timeseries.egg-info/dependency_links.txt +1 -0
  29. echoss_timeseries-1.0.0/echoss_timeseries.egg-info/requires.txt +21 -0
  30. echoss_timeseries-1.0.0/echoss_timeseries.egg-info/top_level.txt +1 -0
  31. echoss_timeseries-1.0.0/pyproject.toml +65 -0
  32. echoss_timeseries-1.0.0/setup.cfg +4 -0
@@ -0,0 +1,204 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the
44
+ purposes of this License, Derivative Works shall not include works
45
+ that remain separable from, or merely link (or bind by name) to the
46
+ interfaces of, the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including the
49
+ original version of the Work and any modifications or additions to
50
+ that Work or Derivative Works thereof, that is intentionally submitted
51
+ to Licensor for inclusion in the Work by the copyright owner or by an
52
+ individual or Legal Entity authorized to submit on behalf of the
53
+ copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control
57
+ systems, and issue tracking systems that are managed by, or on behalf
58
+ of, the Licensor for the purpose of discussing and improving the
59
+ Work, but excluding communication that is conspicuously marked or
60
+ otherwise designated in writing by the copyright owner as "Not a
61
+ Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing
142
+ the origin of the Work and reproducing the content of the NOTICE
143
+ file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or
150
+ conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS
151
+ FOR A PARTICULAR PURPOSE. You are solely responsible for
152
+ determining the appropriateness of using or redistributing the
153
+ Work and assume any risks associated with Your exercise of
154
+ permissions under this License.
155
+
156
+ 8. Limitation of Liability. In no event and under no legal theory,
157
+ whether in tort (including negligence), contract, or otherwise,
158
+ unless required by applicable law (such as deliberate and grossly
159
+ negligent acts) or agreed to in writing, shall any Contributor be
160
+ liable to You for damages, including any direct, indirect, special,
161
+ incidental, or consequential damages of any character arising as a
162
+ result of this License or out of the use or inability to use the
163
+ Work (including but not limited to damages for loss of goodwill,
164
+ work stoppage, computer failure or malfunction, or any and all
165
+ other commercial damages or losses), even if such Contributor
166
+ has been advised of the possibility of such damages.
167
+
168
+ 9. Accepting Warranty or Additional Liability. While redistributing
169
+ the Work or Derivative Works thereof, You may choose to offer,
170
+ and charge a fee for, acceptance of support, warranty, indemnity,
171
+ or other liability obligations and/or rights consistent with this
172
+ License. However, in accepting such obligations, You may act only
173
+ on Your own behalf and on Your sole responsibility, not on behalf
174
+ of any other Contributor, and only if You agree to indemnify,
175
+ defend, and hold each Contributor harmless for any liability
176
+ incurred by, or claims asserted against, such Contributor by reason
177
+ of your accepting any such warranty or additional liability.
178
+
179
+ END OF TERMS AND CONDITIONS
180
+
181
+ APPENDIX: How to apply the Apache License to your work.
182
+
183
+ To apply the Apache License to your work, attach the following
184
+ boilerplate notice, with the fields enclosed by brackets "[]"
185
+ replaced with your own identifying information. (Don't include
186
+ the brackets!) The text should be enclosed in the appropriate
187
+ comment syntax for the file format. We also recommend that a
188
+ file or class name and description of purpose be included on the
189
+ same "printed page" as the copyright notice for easier
190
+ identification within third-party archives.
191
+
192
+ Copyright 2026 12cm
193
+
194
+ Licensed under the Apache License, Version 2.0 (the "License");
195
+ you may not use this file except in compliance with the License.
196
+ You may obtain a copy of the License at
197
+
198
+ http://www.apache.org/licenses/LICENSE-2.0
199
+
200
+ Unless required by applicable law or agreed to in writing, software
201
+ distributed under the License is distributed on an "AS IS" BASIS,
202
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
203
+ See the License for the specific language governing permissions and
204
+ limitations under the License.
@@ -0,0 +1,6 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include echoss_timeseries *.txt *.md
4
+ recursive-exclude * *.log *.log.*
5
+ recursive-exclude * .*.un~
6
+ prune tests
@@ -0,0 +1,263 @@
1
+ Metadata-Version: 2.4
2
+ Name: echoss-timeseries
3
+ Version: 1.0.0
4
+ Summary: echoss AI Bigdata Center 시계열 데이터/모델 기반 라이브러리 (TSData, TSModel, 시계열 피처 및 진단)
5
+ Author: echoss AI Bigdata Center, 12CM Inc.
6
+ License-Expression: Apache-2.0
7
+ Keywords: timeseries,forecasting,feature-engineering,diagnostics,seasonality
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.12
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: echoss-fileformat>=1.3.2
14
+ Requires-Dist: pandas>=3.0.0
15
+ Requires-Dist: numpy>=2.5.3
16
+ Requires-Dist: scipy>=1.18.1
17
+ Requires-Dist: scikit-learn>=1.9.0
18
+ Requires-Dist: statsmodels>=0.15.0
19
+ Requires-Dist: holidays>=0.104
20
+ Requires-Dist: window_ops>=0.0.15
21
+ Requires-Dist: numba>=0.68.0
22
+ Provides-Extra: plot
23
+ Requires-Dist: bokeh>=3.10.0; extra == "plot"
24
+ Requires-Dist: matplotlib>=3.11.1; extra == "plot"
25
+ Provides-Extra: forecast
26
+ Requires-Dist: darts>=0.47.0; extra == "forecast"
27
+ Requires-Dist: statsforecast>=2.0.1; extra == "forecast"
28
+ Requires-Dist: lightgbm>=4.7.0; extra == "forecast"
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest; extra == "dev"
31
+ Dynamic: license-file
32
+
33
+ # echoss-timeseries
34
+
35
+ echoss AI Bigdata Center 시계열 데이터/모델 기반 라이브러리.
36
+
37
+ 여러 도메인 프로젝트가 함께 쓰는 공통 패키지다. 통계 / 기계학습 / 딥러닝 / 트랜스포머 계열
38
+ 시계열 모델을 한 구조 위에서 다루는 것을 목표로 한다.
39
+
40
+ 도메인 프로젝트가 `TSData` / `TSModel` 을 **상속**해서 사용하는 것을 전제로 설계되었다.
41
+ 데이터 로딩·리샘플링·시계열 피처 엔지니어링·진단은 기반 클래스가 담당하고,
42
+ 도메인 고유의 전처리와 학습 로직만 자식 클래스에 구현한다.
43
+
44
+ ## 설치
45
+
46
+ ```bash
47
+ pip install echoss-timeseries # 데이터 · 피처 · 진단 · 모델 골격
48
+ pip install 'echoss-timeseries[plot]' # 플롯까지
49
+ ```
50
+
51
+ ## 요구사항
52
+
53
+ - Python >= 3.12
54
+
55
+ 기본 설치:
56
+
57
+ | 패키지 | 버전 | 용도 |
58
+ |---|---|---|
59
+ | echoss-fileformat | >=1.3.2 | logger, config/파일 IO |
60
+ | pandas | >=3.0.0 | DataFrame |
61
+ | numpy | >=2.5.3 | 수치 연산 |
62
+ | scipy | >=1.18.1 | BoxCox, 통계 |
63
+ | scikit-learn | >=1.9.0 | scaler, encoder, metric |
64
+ | statsmodels | >=0.15.0 | STL, ADF/KPSS, AutoReg |
65
+ | holidays | >=0.104 | 공휴일 피처 |
66
+ | window_ops | >=0.0.15 | seasonal rolling 연산 |
67
+ | numba | >=0.68.0 | window_ops 실행 (0.67 이하는 numpy 2.5 거부) |
68
+
69
+ `[plot]` extras:
70
+
71
+ | 패키지 | 버전 | 용도 |
72
+ |---|---|---|
73
+ | bokeh | >=3.10.0 | 인터랙티브 플롯 |
74
+ | matplotlib | >=3.11.1 | 정적 플롯 |
75
+
76
+ `[forecast]` extras — darts 예측 모델 (`naive_seasonal`, `exponential_smoothing`, `theta`, `auto_arima`, `lightgbm`):
77
+
78
+ | 패키지 | 버전 | 용도 |
79
+ |---|---|---|
80
+ | darts | >=0.47.0 | 예측 모델 (0.46.x 의 Theta 는 statsmodels 0.15 에서 실패) |
81
+ | statsforecast | >=2.0.1 | darts AutoARIMA (2.1.0 부터 pandas<3 을 요구해 pandas 3 과 함께 설치되지 않음) |
82
+ | lightgbm | >=4.7.0 | darts LightGBM |
83
+
84
+ 판매 없는 날(0)이 있는 자료에서 `theta` 는 `hyperparameters: {season_mode: additive}` 로 쓴다 (darts 기본값인 곱셈은 0 을 거부한다). 계절성·추세 방식은 `additive` / `multiplicative` / `none` 문자열로 지정한다. `exponential_smoothing` 은 계절 주기를 자료 간격으로 정한다(일 7, 주 52, 월 12). 7일처럼 배수 간격이거나, 분 단위처럼 주기를 정할 수 없는 간격이거나, 자료가 그 주기의 두 바퀴보다 짧으면 학습 전에 멈추므로, `seasonal_periods` 를 지정하거나 `seasonal: none` 으로 쓴다.
85
+
86
+ extras 없이 플롯·예측 모델을 쓰면 무엇을 설치해야 하는지 알려주는 오류가 난다.
87
+
88
+ 하한은 pandas 3.0.5 조합에서 시험 통과와 청정 환경 설치를 확인한 값이며, 각 패키지의
89
+ 최소 요구 버전을 조사한 값이 아니다. pandas 2.x 환경에는 설치되지 않는다.
90
+
91
+ **필요한 것만 적재된다.** `import echoss_timeseries` 는 이름을 실제로 쓸 때까지 하위 모듈을
92
+ 읽지 않는다. 진단 함수 하나만 쓰면 플롯 라이브러리는 올라오지 않는다.
93
+
94
+ ## 기능
95
+
96
+ | 모듈 | 주요 export |
97
+ |---|---|
98
+ | `echoss_tsdata` | `TSData` — 데이터 로딩/캐시, split, 리샘플링, 피처 추가 진입점 |
99
+ | `echoss_tsmodel` | `TSModel` — `run_models()` 파이프라인 골격, forecast/classification 스코어 |
100
+ | `tsdiag` | `stationarity_tests`, `lag_diagnostics`, `try_autoreg`, `naive_cv_scores`, `seasonal_strength`, `is_constant_series`, `analyze_series`, `ensure_month_start_col`, `validate_month_ms`, `ensure_datetime_freq` |
101
+ | `autoregressive_features` | `add_lag_features`, `add_rolling_features`, `add_seasonal_rolling_features`, `add_ewma_features` |
102
+ | `temporal_features` | `add_temporal_features`, `add_fourier_features`, `bulk_add_fourier_features` |
103
+ | `decomposition` | `BaseDecomposition`, `MultiSeasonalDecomposition`, `FourierDecomposition`, `DecomposeResult` |
104
+ | `outlier` | `detect_outlier_sd`, `detect_outlier_iqr`, `detect_outlier_isolation_forest` |
105
+ | `echoss_plot_bokeh` **[plot]** | `plot_lines`, `plot_datetime`, `plot_forecast`, `plot_train_test_forecast` 등 |
106
+ | `echoss_plot_matplot` **[plot]** | `plot_sales_intensity_heatmap` |
107
+ | `engines` | `ModelEngine`, `DataShape`, `EngineRegistry`, `StatsmodelsArimaEngine`, `SklearnTabularEngine`, `DartsSeriesEngine`, `HoldoutComparison`, `Ensemble`, `WeightedEnsemble`, `Screener`, `Candidate` |
108
+
109
+ ## 사용법
110
+
111
+ ### 1. TSData 상속 — 도메인 데이터 레이어
112
+
113
+ ```python
114
+ from echoss_timeseries import TSData, EventDayFeatures
115
+
116
+
117
+ class BakeryData(TSData):
118
+ """제과점 판매 데이터. 월별 Excel 원천 -> 일별 dense DataFrame."""
119
+
120
+ def __init__(self, data_path='data', config='config/bakery_data.yaml', use_cache=False):
121
+ super().__init__(data_path, config, use_cache=use_cache)
122
+ self.id_col = self.config.get('id_col')
123
+ self.time_col = self.config.get('time_col')
124
+ self.target_col = self.config.get('target_col')
125
+
126
+ def load_raw(self):
127
+ """도메인 원천(Excel/DB) 파싱. 기반 클래스의 add_data() 로 등록한다."""
128
+ raw_df = ... # 도메인 파싱
129
+ self.add_data(raw_df, data_key='raw_df')
130
+
131
+ def prepare_xy_data(self):
132
+ """기반 클래스의 피처 메서드와 EventDayFeatures 를 조합한다. 각 호출은 (df, 추가된_컬럼명) 을 반환한다."""
133
+ df = self.get_dataframe('raw_df')
134
+ df = self.fill_to_frequency(df, 'D', time_col=self.time_col, id_col=self.id_col)
135
+ df, _ = self.add_temporal_features(df, time_col=self.time_col, frequency='D')
136
+ df, _ = EventDayFeatures(country="KR").add_features(df, time_col=self.time_col)
137
+ df, _ = self.add_lag_features(df, lags=[1, 7, 14], column=self.target_col, ts_id=self.id_col)
138
+ df, _ = self.add_rolling_features(df, rolls=[7, 28], column=self.target_col, ts_id=self.id_col)
139
+ self.add_data(df, data_key='daily_dense_df')
140
+ ```
141
+
142
+ 데이터는 항상 cache 에 쓰고, `use_cache=True` 일 때만 cache 에서 읽는다. cache 는 `cache_dir`(기본 `cached`, 실행 폴더 기준)에
143
+ `{config 파일명}_{data_key}` 로 저장되며, 같은 `cache_dir` 의 인스턴스는 cache 를 공유한다(config 가 dict 이면 이름은 `cache`).
144
+ 나누려면 `cache_dir` 나 `cache_suffix` 를 지정한다.
145
+
146
+ ### 2. TSModel 상속 — 도메인 모델 레이어
147
+
148
+ `run_models()` 가 `prepare_dataset()` -> `training_model()` -> `evaluation_model()` 순서로
149
+ 자식 클래스 구현을 호출한다. 단계 간 데이터 전달은 `self.runtime_dict` 를 사용한다.
150
+
151
+ ```python
152
+ from echoss_timeseries import TSModel
153
+
154
+
155
+ class BakeryModel(TSModel):
156
+ """2단계 예측: has_sales 분류 -> 수량 회귀."""
157
+
158
+ def prepare_dataset(self, df):
159
+ # split 은 데이터 레이어 책임 — self.ts_data 를 통해 호출한다
160
+ train_df, test_df = self.ts_data.split_data(df, split_date=self.config.get('split_date'))
161
+ self.runtime_dict['train_df'] = train_df
162
+ self.runtime_dict['test_df'] = test_df
163
+
164
+ def training_model(self):
165
+ train_df = self.runtime_dict['train_df']
166
+ # 도메인 학습 엔진 호출 (AutoGluon, pycaret 등)
167
+ self.runtime_dict['predictor'] = ...
168
+ return self.runtime_dict
169
+
170
+ def evaluation_model(self):
171
+ test_df = self.runtime_dict['test_df']
172
+ pred_df = self.runtime_dict['pred_df']
173
+ return self.calculate_forecast_score(
174
+ test_df[self.config['target_col']], pred_df['pred_y'],
175
+ )
176
+
177
+
178
+ ts_data = BakeryData(data_path='data', config='config/bakery_data.yaml')
179
+ ts_data.load_raw()
180
+ ts_data.prepare_xy_data()
181
+
182
+ model = BakeryModel(ts_data, config='config/bakery_model.yaml', result_save_path='results/')
183
+ model.run_models(data='daily_dense_df', training_kwargs={'year_month': '2026-05'})
184
+ ```
185
+
186
+ 인스턴스는 원하는 만큼 만들 수 있다. `TSData` 와 `TSModel` 의 가변 상태(`data_map`,
187
+ `runtime_dict`, scaler·encoder 맵 등)는 인스턴스마다 분리된다.
188
+
189
+ `show_plot` 같은 불변 플래그만 클래스 레벨에 남아 있어, 자식 클래스에서 클래스 레벨로
190
+ 기본값을 바꿀 수 있다.
191
+
192
+ ### 3. 시계열 진단 (tsdiag)
193
+
194
+ 상속 없이 모듈 함수로 바로 사용한다.
195
+
196
+ ```python
197
+ from echoss_timeseries import analyze_series, stationarity_tests, naive_cv_scores
198
+
199
+ result = analyze_series(ts, freq='D', seasonal_period=7, max_ar=12, horizon=14)
200
+ print(result['predictability_score'], result['seasonal_strength'])
201
+
202
+ print(stationarity_tests(ts)) # adf_pvalue, kpss_pvalue
203
+ print(naive_cv_scores(ts, horizon=14, seasonal_period=7))
204
+ ```
205
+
206
+ 도메인 컬럼명은 라이브러리 기본값으로 두지 않는다. `validate_month_ms(df, time_col='날짜')`
207
+ 처럼 호출부가 명시 전달한다.
208
+
209
+ ## 알려진 한계 (1.0.0)
210
+
211
+ 고치지 않고 공개한 동작이다. 고치면 동작이 바뀌므로 다음 major 에서 다룬다.
212
+
213
+ | 대상 | 한계 | 우회 |
214
+ |---|---|---|
215
+ | `TSData.set_dataframe` | 등록되지 않은 `data_key` 로 부르면 예외 없이 지나가고 cache 에만 쓴다 | 새 키 등록은 `add_data`, `set_dataframe` 은 기존 키 갱신에만 쓴다 |
216
+ | `EventDayFeatures.add_features` | 넘겨받은 DataFrame 에 컬럼을 직접 더한다 | 원본을 지켜야 하면 `df.copy()` 를 넘긴다 |
217
+ | `HoldoutComparison.run` | 시계열 하나라도 결측이 있으면 비교 전체를 `ValueError` 로 거부한다 | 결측을 미리 채우거나 시계열마다 따로 `run()` 한다 |
218
+ | `analyze_series` 의 `predictability_score` | 실측 판매 자료(상품 71개)에서 실제 예측 오차와 반대 방향으로 움직였다 | 모델 선택이나 예측 난이도 판정에 쓰지 않는다 |
219
+ | `MultiSeasonalDecomposition('fourier', ...)` | 요일 주기(`day_of_week`) 성분의 세기가 항상 0 으로 나온다 | 요일 주기는 STL 이나 averages 방식으로 분해한다 |
220
+ | `seasonal_esd` | 원 알고리즘(S-H-ESD)대로 추세를 빼지 않아 추세가 있는 자료에서 이상치를 놓친다 | 추세를 먼저 빼고 넘긴다 |
221
+ | `is_constant_series` | 넘파이 불리언을 돌려준다 | `is True` 대신 진리값으로 비교한다 |
222
+
223
+ ## 문서
224
+
225
+ | 문서 | 내용 |
226
+ |---|---|
227
+ | [`prior-work.jsonl`](prior-work.jsonl) | 작업원장. 이전 작업의 결론과 다시 하지 말 것, 백로그 |
228
+ | [`docs/known-issues.md`](docs/known-issues.md) | 사용자용. 알려진 문제와 우회 방법 |
229
+ | [`docs/backlog.md`](docs/backlog.md) | 개발자용. 결함 대장(B4~B13), config 주도 실행 통제 미비(G1~G4), 참조 프로젝트 결함(S1~S2) |
230
+ | [`docs/design/engine-abstraction.md`](docs/design/engine-abstraction.md) | 학습 엔진 추상화 ABC 설계 (구현 전) |
231
+
232
+ ## 앞으로
233
+
234
+ 알고리즘을 교체하고 결합할 수 있는 계층을 만들고 있다 — 후보 알고리즘을 추리는 **선별기**,
235
+ 알고리즘 하나를 감싸는 **모델 엔진**, 여러 모델을 합치는 **앙상블** 셋으로 나눈다.
236
+
237
+ **모델 엔진과 앙상블은 동작한다. 선별기는 ABC 만 있다** — AutoML 어댑터는 아직 없다.
238
+
239
+ ```python
240
+ from echoss_timeseries import EngineRegistry, WeightedEnsemble
241
+
242
+ # 알고리즘은 config 로 고른다. 이름은 알고리즘 이름이다 (라이브러리 이름이 아니다)
243
+ models = EngineRegistry.build_models({"models": [
244
+ {"name": "arima", "hyperparameters": {"order": [1, 1, 1]}},
245
+ {"name": "random_forest", "problem_type": "regression", "target_col": "y"},
246
+ ]})
247
+
248
+ engine = models[0].fit(series)
249
+ pred = engine.predict(future_index) # 예측 길이는 넘긴 인덱스의 길이로 정해진다
250
+
251
+ # 여러 모델을 검증오차 역수로 가중 평균한다
252
+ ensemble = WeightedEnsemble().fit(fitted_models, (valid_x, valid_y))
253
+ print(ensemble.weights()) # 어느 모델이 얼마나 기여했는지 설명된다
254
+ ```
255
+
256
+ config 에 모르는 이름이나 키를 적으면 **예외**가 난다. 조용히 무시하면 그 설정이 적용되지
257
+ 않은 채 실행되고, 결과만 보고는 원인을 찾을 수 없다.
258
+
259
+ 설계는 `docs/design/engine-abstraction.md` 에 있다.
260
+
261
+ ## License
262
+
263
+ Apache-2.0