analysis3054 0.1.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.
@@ -0,0 +1,121 @@
1
+ Metadata-Version: 2.4
2
+ Name: analysis3054
3
+ Version: 0.1.0
4
+ Summary: Advanced time-series analytics and forecasting toolkit for commodity / power trading (5-year bands, ML, regime switching, hierarchical utilities).
5
+ Author-email: secret <john23114693@gmial.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://pypi.org/project/analysis3054/
8
+ Project-URL: Repository, https://github.com/yourname/analysis3054
9
+ Keywords: time-series,forecasting,power-trading,commodity,energy,analytics
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Intended Audience :: Financial and Insurance Industry
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Topic :: Scientific/Engineering
17
+ Classifier: Topic :: Office/Business :: Financial
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+ Requires-Dist: pandas>=1.5
21
+ Requires-Dist: numpy>=1.24
22
+ Requires-Dist: plotly>=5.20
23
+ Requires-Dist: statsmodels>=0.13
24
+ Requires-Dist: scipy>=1.10
25
+ Provides-Extra: stats
26
+ Requires-Dist: pmdarima>=2.0; extra == "stats"
27
+ Requires-Dist: arch>=6.0; extra == "stats"
28
+ Provides-Extra: ml
29
+ Requires-Dist: scikit-learn>=1.2; extra == "ml"
30
+ Requires-Dist: xgboost>=2.0; extra == "ml"
31
+ Requires-Dist: lightgbm>=4.0; extra == "ml"
32
+ Requires-Dist: catboost>=1.2; extra == "ml"
33
+ Provides-Extra: dl
34
+ Requires-Dist: tensorflow>=2.12; extra == "dl"
35
+ Provides-Extra: prophet
36
+ Requires-Dist: prophet>=1.1; extra == "prophet"
37
+ Requires-Dist: neuralprophet>=0.6.0; extra == "prophet"
38
+ Provides-Extra: tbats
39
+ Requires-Dist: tbats>=1.1.3; extra == "tbats"
40
+ Provides-Extra: plot
41
+ Requires-Dist: plotly>=5.20; extra == "plot"
42
+ Provides-Extra: all
43
+ Requires-Dist: analysis3054[dl,ml,plot,prophet,stats,tbats]; extra == "all"
44
+
45
+ # EIA Band Plot & Time Series Forecasting
46
+
47
+ This package provides two primary utilities:
48
+
49
+ * **`five_year_plot`** – Generate interactive 5‑year band plots using
50
+ Plotly. These plots mirror the charts used by the U.S. Energy
51
+ Information Administration (EIA) to contextualize recent values
52
+ against the range, minimum, maximum and average of the last five
53
+ years. Multiple numeric columns within a DataFrame can be plotted
54
+ simultaneously as separate subplots.
55
+
56
+ * **`ml_forecast`** – Train individual AutoGluon time series models
57
+ for each numeric column in a DataFrame and forecast future values.
58
+ The function returns a DataFrame with point forecasts and, if
59
+ requested, prediction intervals. Each series is trained
60
+ independently using the specified presets (default: `best_quality`).
61
+
62
+ ## Installation
63
+
64
+ Install the package with:
65
+
66
+
67
+ ```bash
68
+ pip install analysis3054
69
+ ```
70
+
71
+ To enable the optional machine‑learning forecasting features, also
72
+ install the AutoGluon time series dependency:
73
+
74
+ ```bash
75
+ pip install analysis3054[ml]
76
+ ```
77
+
78
+ ## Usage
79
+
80
+ ### Five‑Year Band Plot
81
+
82
+ ```python
83
+ import pandas as pd
84
+ from analysis3054 import five_year_plot
85
+
86
+ # Example DataFrame with a 'date' column and one or more numeric columns
87
+ df = pd.read_csv("my_timeseries_data.csv")
88
+
89
+ # Create the plot
90
+ fig = five_year_plot(date='date', df=df, prior_year_lines=1)
91
+ fig.show()
92
+ ```
93
+
94
+ ### Machine Learning Forecasting
95
+
96
+ ```python
97
+ import pandas as pd
98
+ from analysis3054 import ml_forecast
99
+
100
+ df = pd.read_csv("my_timeseries_data.csv")
101
+
102
+ # Forecast the next 12 periods for each numeric column
103
+ result = ml_forecast(date='date', df=df, periods=12)
104
+
105
+ # Access point forecasts
106
+ forecasts = result.forecasts
107
+
108
+ # Access confidence intervals (if requested)
109
+ conf_ints = result.conf_intervals
110
+ ```
111
+
112
+ See the docstrings of each function for detailed parameter descriptions.
113
+
114
+ ## User Guide
115
+
116
+ For a complete overview of all available functions, advanced
117
+ forecasting methods, statistical analyses and plotting utilities,
118
+ consult the **USER_GUIDE.md** file included with the package. It
119
+ provides step‑by‑step examples, explains optional parameters such as
120
+ confidence interval computation and plotting, and offers best
121
+ practices for combining models and interpreting results.
@@ -0,0 +1,77 @@
1
+ # EIA Band Plot & Time Series Forecasting
2
+
3
+ This package provides two primary utilities:
4
+
5
+ * **`five_year_plot`** – Generate interactive 5‑year band plots using
6
+ Plotly. These plots mirror the charts used by the U.S. Energy
7
+ Information Administration (EIA) to contextualize recent values
8
+ against the range, minimum, maximum and average of the last five
9
+ years. Multiple numeric columns within a DataFrame can be plotted
10
+ simultaneously as separate subplots.
11
+
12
+ * **`ml_forecast`** – Train individual AutoGluon time series models
13
+ for each numeric column in a DataFrame and forecast future values.
14
+ The function returns a DataFrame with point forecasts and, if
15
+ requested, prediction intervals. Each series is trained
16
+ independently using the specified presets (default: `best_quality`).
17
+
18
+ ## Installation
19
+
20
+ Install the package with:
21
+
22
+
23
+ ```bash
24
+ pip install analysis3054
25
+ ```
26
+
27
+ To enable the optional machine‑learning forecasting features, also
28
+ install the AutoGluon time series dependency:
29
+
30
+ ```bash
31
+ pip install analysis3054[ml]
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ ### Five‑Year Band Plot
37
+
38
+ ```python
39
+ import pandas as pd
40
+ from analysis3054 import five_year_plot
41
+
42
+ # Example DataFrame with a 'date' column and one or more numeric columns
43
+ df = pd.read_csv("my_timeseries_data.csv")
44
+
45
+ # Create the plot
46
+ fig = five_year_plot(date='date', df=df, prior_year_lines=1)
47
+ fig.show()
48
+ ```
49
+
50
+ ### Machine Learning Forecasting
51
+
52
+ ```python
53
+ import pandas as pd
54
+ from analysis3054 import ml_forecast
55
+
56
+ df = pd.read_csv("my_timeseries_data.csv")
57
+
58
+ # Forecast the next 12 periods for each numeric column
59
+ result = ml_forecast(date='date', df=df, periods=12)
60
+
61
+ # Access point forecasts
62
+ forecasts = result.forecasts
63
+
64
+ # Access confidence intervals (if requested)
65
+ conf_ints = result.conf_intervals
66
+ ```
67
+
68
+ See the docstrings of each function for detailed parameter descriptions.
69
+
70
+ ## User Guide
71
+
72
+ For a complete overview of all available functions, advanced
73
+ forecasting methods, statistical analyses and plotting utilities,
74
+ consult the **USER_GUIDE.md** file included with the package. It
75
+ provides step‑by‑step examples, explains optional parameters such as
76
+ confidence interval computation and plotting, and offers best
77
+ practices for combining models and interpreting results.
@@ -0,0 +1,295 @@
1
+ """
2
+ EIA Band Plot Package
3
+ =====================
4
+
5
+ This package provides a convenient function for generating
6
+ `5‑year band` plots similar to those used by the U.S. Energy
7
+ Information Administration (EIA). These plots visualize the
8
+ historical range, average, and current/prior year values for a
9
+ time series, making it easy to see how recent data compare with
10
+ the last five years of history.
11
+
12
+ The primary entry point is :func:`~analysis3054.five_year_plot`.
13
+
14
+ Example
15
+ -------
16
+ .. code-block:: python
17
+
18
+ import pandas as pd
19
+ from analysis3054 import five_year_plot
20
+
21
+ # Suppose `df` has a ``date`` column and one or more value columns
22
+ fig = five_year_plot(date=df['date'], df=df)
23
+ fig.show()
24
+ """
25
+
26
+ from .plot import five_year_plot
27
+ from .ml import ml_forecast, ForecastResult
28
+ from .predict import monthly_predictor, MonthlyPredictionResult
29
+ from .utils import (
30
+ conditional_column_merge,
31
+ conditional_row_merge,
32
+ nearest_key_merge,
33
+ coalesce_merge,
34
+ rolling_fill,
35
+ data_quality_report,
36
+ )
37
+ from .estimators import (
38
+ bayesian_linear_estimator,
39
+ BayesianLinearResult,
40
+ gaussian_process_estimator,
41
+ GaussianProcessResult,
42
+ load_based_forecast,
43
+ LoadForecastResult,
44
+ )
45
+ from .finance import (
46
+ liquidity_adjusted_volatility,
47
+ LiquidityAdjustedVolatilityResult,
48
+ rolling_beta,
49
+ RollingBetaResult,
50
+ )
51
+ from .visualization import (
52
+ cumulative_return_plot,
53
+ DrawdownResult,
54
+ max_drawdown,
55
+ forecast_plot,
56
+ acf_pacf_plot,
57
+ )
58
+ from .stats import (
59
+ cross_correlation_plot,
60
+ partial_autocorrelation_plot,
61
+ PCAResult,
62
+ pca_decomposition,
63
+ granger_causality_matrix,
64
+ )
65
+ from .forecasting import (
66
+ arima_forecast,
67
+ ArimaForecastResult,
68
+ ets_forecast,
69
+ EtsForecastResult,
70
+ var_forecast,
71
+ VarForecastResult,
72
+ auto_arima_forecast,
73
+ AutoArimaForecastResult,
74
+ prophet_forecast,
75
+ ProphetForecastResult,
76
+ markov_switching_forecast,
77
+ MarkovSwitchingForecastResult,
78
+ unobserved_components_forecast,
79
+ UnobservedComponentsForecastResult,
80
+ dynamic_factor_forecast,
81
+ DynamicFactorForecastResult,
82
+ # Newly added advanced forecasting functions
83
+ sarimax_forecast,
84
+ SarimaxForecastResult,
85
+ lstm_forecast,
86
+ LstmForecastResult,
87
+ garch_forecast,
88
+ GarchForecastResult,
89
+ vecm_forecast,
90
+ VecmForecastResult,
91
+ xgboost_forecast,
92
+ XGBoostForecastResult,
93
+ lightgbm_forecast,
94
+ LightGBMForecastResult,
95
+ theta_forecast,
96
+ ThetaForecastResult,
97
+ # Additional advanced forecasting methods
98
+ elastic_net_forecast,
99
+ ElasticNetForecastResult,
100
+ svr_forecast,
101
+ SvrForecastResult,
102
+ tcn_forecast,
103
+ TcnForecastResult,
104
+ bats_forecast,
105
+ BatsForecastResult,
106
+ neuralprophet_forecast,
107
+ NeuralProphetForecastResult,
108
+ catboost_forecast,
109
+ CatBoostForecastResult,
110
+ knn_forecast,
111
+ KnnForecastResult,
112
+ transformer_forecast,
113
+ TransformerForecastResult,
114
+ )
115
+ from .advanced import (
116
+ harmonic_forecast,
117
+ HarmonicForecastResult,
118
+ ewma_volatility,
119
+ EwmaVolatilityResult,
120
+ monte_carlo_simulation,
121
+ MonteCarloSimulationResult,
122
+ value_at_risk,
123
+ VaRResult,
124
+ cointegration_test,
125
+ CointegrationTestResult,
126
+ spectral_density_plot,
127
+ wavelet_spectrogram,
128
+ kalman_smoother,
129
+ resample_time_series,
130
+ stl_decompose_plot,
131
+ )
132
+
133
+ # Statistical functions
134
+ from .statistics import (
135
+ hurst_exponent,
136
+ dfa_exponent,
137
+ rolling_sharpe_ratio,
138
+ sample_entropy,
139
+ higuchi_fractal_dimension,
140
+ RollingSharpeResult,
141
+ rolling_zscore,
142
+ RollingZScoreResult,
143
+ mann_kendall_test,
144
+ MannKendallResult,
145
+ bollinger_bands,
146
+ BollingerBandsResult,
147
+ stationarity_tests,
148
+ StationarityTestResult,
149
+ trend_seasonality_strength,
150
+ TrendSeasonalityStrengthResult,
151
+ box_cox_transform,
152
+ BoxCoxTransformResult,
153
+ seasonal_adjust,
154
+ SeasonalAdjustmentResult,
155
+ )
156
+
157
+ # Regression and correlation utilities
158
+ from .regression import (
159
+ ols_regression,
160
+ RegressionResult,
161
+ rolling_correlation,
162
+ RollingCorrelationResult,
163
+ cusum_olsresid_test,
164
+ CusumTestResult,
165
+ )
166
+
167
+ __all__ = [
168
+ "five_year_plot",
169
+ "ml_forecast",
170
+ "ForecastResult",
171
+ "monthly_predictor",
172
+ "MonthlyPredictionResult",
173
+ "harmonic_forecast",
174
+ "HarmonicForecastResult",
175
+ "ewma_volatility",
176
+ "EwmaVolatilityResult",
177
+ "monte_carlo_simulation",
178
+ "MonteCarloSimulationResult",
179
+ "value_at_risk",
180
+ "VaRResult",
181
+ "cointegration_test",
182
+ "CointegrationTestResult",
183
+ "spectral_density_plot",
184
+ "wavelet_spectrogram",
185
+ "kalman_smoother",
186
+ "resample_time_series",
187
+ "stl_decompose_plot",
188
+ # data utilities
189
+ "conditional_column_merge",
190
+ "conditional_row_merge",
191
+ "nearest_key_merge",
192
+ "coalesce_merge",
193
+ "rolling_fill",
194
+ # advanced estimators
195
+ "bayesian_linear_estimator",
196
+ "BayesianLinearResult",
197
+ "gaussian_process_estimator",
198
+ "GaussianProcessResult",
199
+ "load_based_forecast",
200
+ "LoadForecastResult",
201
+ # financial analytics
202
+ "liquidity_adjusted_volatility",
203
+ "LiquidityAdjustedVolatilityResult",
204
+ "rolling_beta",
205
+ "RollingBetaResult",
206
+ # additional utilities and plotting
207
+ "data_quality_report",
208
+ "cumulative_return_plot",
209
+ "DrawdownResult",
210
+ "max_drawdown",
211
+ "forecast_plot",
212
+ "acf_pacf_plot",
213
+ # statistical analysis
214
+ "cross_correlation_plot",
215
+ "partial_autocorrelation_plot",
216
+ "PCAResult",
217
+ "pca_decomposition",
218
+ "granger_causality_matrix",
219
+ # forecasting
220
+ "arima_forecast",
221
+ "ArimaForecastResult",
222
+ "ets_forecast",
223
+ "EtsForecastResult",
224
+ "var_forecast",
225
+ "VarForecastResult",
226
+ "auto_arima_forecast",
227
+ "AutoArimaForecastResult",
228
+ "prophet_forecast",
229
+ "ProphetForecastResult",
230
+ "markov_switching_forecast",
231
+ "MarkovSwitchingForecastResult",
232
+ "unobserved_components_forecast",
233
+ "UnobservedComponentsForecastResult",
234
+ "dynamic_factor_forecast",
235
+ "DynamicFactorForecastResult",
236
+ # Newly added advanced forecasting functions
237
+ "sarimax_forecast",
238
+ "SarimaxForecastResult",
239
+ "lstm_forecast",
240
+ "LstmForecastResult",
241
+ "garch_forecast",
242
+ "GarchForecastResult",
243
+ "vecm_forecast",
244
+ "VecmForecastResult",
245
+ "xgboost_forecast",
246
+ "XGBoostForecastResult",
247
+ "lightgbm_forecast",
248
+ "LightGBMForecastResult",
249
+ "theta_forecast",
250
+ "ThetaForecastResult",
251
+ # newly added advanced forecasting methods
252
+ "elastic_net_forecast",
253
+ "ElasticNetForecastResult",
254
+ "svr_forecast",
255
+ "SvrForecastResult",
256
+ "tcn_forecast",
257
+ "TcnForecastResult",
258
+ "bats_forecast",
259
+ "BatsForecastResult",
260
+ "neuralprophet_forecast",
261
+ "NeuralProphetForecastResult",
262
+ "catboost_forecast",
263
+ "CatBoostForecastResult",
264
+ "knn_forecast",
265
+ "KnnForecastResult",
266
+ "transformer_forecast",
267
+ "TransformerForecastResult",
268
+ "hurst_exponent",
269
+ "dfa_exponent",
270
+ "rolling_sharpe_ratio",
271
+ "RollingSharpeResult",
272
+ "sample_entropy",
273
+ "higuchi_fractal_dimension",
274
+ "rolling_zscore",
275
+ "RollingZScoreResult",
276
+ "mann_kendall_test",
277
+ "MannKendallResult",
278
+ "bollinger_bands",
279
+ "BollingerBandsResult",
280
+ "stationarity_tests",
281
+ "StationarityTestResult",
282
+ "trend_seasonality_strength",
283
+ "TrendSeasonalityStrengthResult",
284
+ "box_cox_transform",
285
+ "BoxCoxTransformResult",
286
+ "seasonal_adjust",
287
+ "SeasonalAdjustmentResult",
288
+ # regression and correlation
289
+ "ols_regression",
290
+ "RegressionResult",
291
+ "rolling_correlation",
292
+ "RollingCorrelationResult",
293
+ "cusum_olsresid_test",
294
+ "CusumTestResult",
295
+ ]