Captain-Slow commited on
Commit
50bacee
·
verified ·
1 Parent(s): bcaabce

Upload 13 files

Browse files
Files changed (13) hide show
  1. .DS_Store +0 -0
  2. .gitignore +236 -0
  3. MANIFEST.in +0 -0
  4. README.md +78 -3
  5. __init__.py +1 -0
  6. nb.ipynb +0 -0
  7. pyproject.toml +12 -0
  8. requirements.txt +8 -0
  9. requirements_dev.txt +16 -0
  10. setup.cfg +34 -0
  11. setup.py +28 -0
  12. smoothing.py +25 -0
  13. tox.ini +24 -0
.DS_Store ADDED
Binary file (8.2 kB). View file
 
.gitignore ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ __pycache__
4
+ *.py[cod]
5
+ *$py.class
6
+
7
+ # C extensions
8
+ *.so
9
+
10
+ # Distribution / packaging
11
+ .Python
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ wheels/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ DynamicTS.egg-info
29
+ MANIFEST
30
+
31
+ # PyInstaller
32
+ # Usually these files are written by a python script from a template
33
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
34
+ *.manifest
35
+ *.spec
36
+
37
+ # Installer logs
38
+ pip-log.txt
39
+ pip-delete-this-directory.txt
40
+
41
+ # Unit test / coverage reports
42
+ htmlcov/
43
+ .tox/
44
+ .nox/
45
+ .coverage
46
+ .coverage.*
47
+ .cache
48
+ nosetests.xml
49
+ coverage.xml
50
+ *.cover
51
+ *.py,cover
52
+ .hypothesis/
53
+ .pytest_cache/
54
+ cover/
55
+
56
+ # Translations
57
+ *.mo
58
+ *.pot
59
+
60
+ # Django stuff:
61
+ *.log
62
+ local_settings.py
63
+ db.sqlite3
64
+ db.sqlite3-journal
65
+
66
+ # Flask stuff:
67
+ instance/
68
+ .webassets-cache
69
+
70
+ # Scrapy stuff:
71
+ .scrapy
72
+
73
+ # Sphinx documentation
74
+ docs/_build/
75
+
76
+ # PyBuilder
77
+ .pybuilder/
78
+ target/
79
+
80
+ # Jupyter Notebook
81
+ .ipynb_checkpoints
82
+
83
+ # IPython
84
+ profile_default/
85
+ ipython_config.py
86
+
87
+ # pyenv
88
+ # For a library or package, you might want to ignore these files since the code is
89
+ # intended to run in multiple environments; otherwise, check them in:
90
+ # .python-version
91
+
92
+ # pipenv
93
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
94
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
95
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
96
+ # install all needed dependencies.
97
+ #Pipfile.lock
98
+
99
+ # UV
100
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
101
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
102
+ # commonly ignored for libraries.
103
+ #uv.lock
104
+
105
+ # poetry
106
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
107
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
108
+ # commonly ignored for libraries.
109
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
110
+ #poetry.lock
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ #pdm.lock
115
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
116
+ # in version control.
117
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
118
+ .pdm.toml
119
+ .pdm-python
120
+ .pdm-build/
121
+
122
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
123
+ __pypackages__/
124
+
125
+ # Celery stuff
126
+ celerybeat-schedule
127
+ celerybeat.pid
128
+
129
+ # SageMath parsed files
130
+ *.sage.py
131
+
132
+ # Environments
133
+ .myenv
134
+ .env
135
+ .venv
136
+ env/
137
+ venv/
138
+ ENV/
139
+ env.bak/
140
+ venv.bak/
141
+
142
+ # Spyder project settings
143
+ .spyderproject
144
+ .spyproject
145
+
146
+ # Rope project settings
147
+ .ropeproject
148
+
149
+ # mkdocs documentation
150
+ /site
151
+
152
+ # mypy
153
+ .mypy_cache/
154
+ .dmypy.json
155
+ dmypy.json
156
+
157
+ # Pyre type checker
158
+ .pyre/
159
+
160
+ # pytype static type analyzer
161
+ .pytype/
162
+
163
+ # Cython debug symbols
164
+ cython_debug/
165
+
166
+ # PyCharm
167
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
168
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
169
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
170
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
171
+ #.idea/
172
+
173
+ # Abstra
174
+ # Abstra is an AI-powered process automation framework.
175
+ # Ignore directories containing user credentials, local state, and settings.
176
+ # Learn more at https://abstra.io/docs
177
+ .abstra/
178
+
179
+ # Visual Studio Code
180
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
181
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
182
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
183
+ # you could uncomment the following to ignore the enitre vscode folder
184
+ # .vscode/
185
+
186
+ # Ruff stuff:
187
+ .ruff_cache/
188
+
189
+ # PyPI configuration file
190
+ .pypirc
191
+
192
+ # Cursor
193
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
194
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
195
+ # refer to https://docs.cursor.com/context/ignore-files
196
+ .cursorignore
197
+ .cursorindexingignore
198
+
199
+
200
+ /data
201
+ data
202
+ /data/
203
+ data/
204
+
205
+
206
+ # Directories to ignore:
207
+ sample_data/
208
+
209
+ ignore
210
+ /ignore
211
+ ignore/
212
+ /ignore/
213
+
214
+ logs
215
+ metadata
216
+ **/reports/
217
+
218
+ /logs
219
+ /metadata
220
+ reports/
221
+ =======
222
+ metadata/
223
+ logs/
224
+ **/metadata/
225
+ **/logs/
226
+
227
+
228
+ # Files to ignore:
229
+ test.ipynb
230
+ **/.gitignore
231
+
232
+ **/.DS_Store/
233
+
234
+
235
+ dynamicts.egg-info
236
+
MANIFEST.in ADDED
File without changes
README.md CHANGED
@@ -1,3 +1,78 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DynamicTS
2
+
3
+ ## What is DynamicTS?
4
+
5
+ **DynamicTS** is an educational-first Python library for time series analysis and preprocessing.
6
+ It is designed to make time series workflows easy to use, easy to interpret, and easy to teach.
7
+ DynamicTS provides clear, automated reports and visualizations that help users not only run analyses, but also understand and explain the results.
8
+
9
+ Whether you are a student, educator, or practitioner, DynamicTS aims to bridge the gap between powerful time series methods and accessible, readable outputs.
10
+ With a focus on transparency and best practices, DynamicTS is your companion for learning, teaching, and applying time series analysis in Python.
11
+ A Python library for time series analysis.
12
+
13
+ ## Main Features
14
+
15
+ DynamicTS is built to make time series analysis accessible and insightful by combining robust analytics with clear, user-friendly reporting. Each module is designed to automate best practices and generate readable reports that help users interpret results with confidence.
16
+
17
+ - **Data Loader Module**
18
+ Load your time series data from CSV files with robust handling of date parsing and index regularity checks. The loader automatically validates your data, checks for irregular timestamps, and saves metadata reports for easy reference.
19
+ 2
20
+ - **Analysis Module**
21
+ Perform comprehensive univariate analysis on your time series data. This module automatically generates distribution plots, missing value checks and outlier detection. All results are compiled into a well-structured Markdown or HTML report, making it easy to review and share insights.
22
+
23
+ - **Lag Correlation Module**
24
+ Explore autocorrelation and partial autocorrelation with ACF and PACF plots, as well as lag matrix visualizations. The module summarizes findings in a report, highlighting significant lags and patterns to help you understand temporal dependencies in your data.
25
+
26
+
27
+ - **Stationarity Module**
28
+ Assess the stationarity of your time series using statistical tests like the Augmented Dickey-Fuller (ADF) test and rolling statistics. The module generates clear visualizations and a summary report, guiding you through the interpretation of stationarity results and next steps.
29
+
30
+ - **Volatility Check Module**
31
+ Assess the volatility and variability of your time series using advanced models such as ARCH and GARCH. This module applies these models to detect and visualize periods of changing volatility, helping you understand the dynamic behavior of your data. Results are presented through intuitive plots and a concise, user-friendly report, making it easy to interpret volatility patterns and their implications for stationarity.
32
+
33
+ All modules are designed to output their results as readable, shareable reports (Markdown or HTML) saved next to your data file by default. This ensures that every analysis is not only rigorous, but also easy to understand and communicate.
34
+
35
+ ## Where to Get DynamicTS
36
+
37
+ You can easily install DynamicTS using pip from the Python Package Index (PyPI):
38
+
39
+ ```sh
40
+ pip install dynamicts
41
+ ```
42
+
43
+ PyPI page: [https://pypi.org/project/dynamicts/](https://pypi.org/project/dynamicts/)
44
+
45
+ Alternatively, you can get the latest development version directly from GitHub:
46
+
47
+ ```sh
48
+ pip install git+https://github.com/Chinar-Quantum-AI-Ltd/DynamicTS.git
49
+ ```
50
+
51
+ GitHub repository: [https://github.com/Chinar-Quantum-AI-Ltd/DynamicTS](https://github.com/Chinar-Quantum-AI-Ltd/DynamicTS)
52
+
53
+ ## Maintainers
54
+
55
+ ### Cultivating AI Excellence
56
+
57
+ DynamicTS is maintained by [Chinar Quantum AI (CQAI)](https://chinarqai.com), an organization dedicated to advancing AI education and workforce readiness.
58
+
59
+ At CQAI, we believe in training differently to address the exponential growth of the AI industry and the evolving demands of the job market. Our tailored training programs, rooted in first principles, bridge the gap between diverse backgrounds and industry requirements. By focusing on generative AI, we empower individuals to meet the industry's burgeoning demands and play a significant role in mitigating the global unemployment crisis.
60
+
61
+ Our approach is multifaceted, with strategic objectives such as industry-grade projects, comprehensive mathematical and computational training, and partnerships with various institutions. Through these initiatives, we democratize AI education, empowering individuals from diverse backgrounds to pursue rewarding careers in AI and Data Science.
62
+
63
+ Learn more about our mission and programs at [chinarqai.com](https://chinarqai.com).
64
+
65
+ ## Dependencies
66
+
67
+ DynamicTS relies on a set of well-established Python libraries to provide robust time series analysis and reporting:
68
+
69
+ - **pandas**: For data manipulation and handling time series data structures.
70
+ - **numpy**: For efficient numerical computations and array operations.
71
+ - **matplotlib**: For generating high-quality plots and visualizations.
72
+ - **statsmodels**: For advanced statistical modeling and time series analysis, including stationarity tests.
73
+ - **seaborn**: For enhanced statistical data visualization.
74
+ - **pytest (>=7.4.0)**: For running the test suite and ensuring code reliability.
75
+ - **IPython**: For interactive computing and improved notebook integration.
76
+ - **arch (==7.2.0)**: For volatility modeling using ARCH and GARCH models.
77
+
78
+ These dependencies ensure that DynamicTS delivers a comprehensive, reliable, and user-friendly experience for time series analysis and education.
__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ __version__ = '0.1.0'
nb.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
pyproject.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [build.system]
2
+ requires = ['setuptools>=42.0', 'wheel']
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [tool.pytest.ini_options]
6
+ testpaths = [
7
+ "tests"
8
+ ]
9
+
10
+ [tool.mypy]
11
+ mypy_path = "dynamicts"
12
+ ignore_missing_imports = true
requirements.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ pandas
2
+ numpy
3
+ matplotlib
4
+ statsmodels
5
+ seaborn
6
+ pytest>=7.4.0
7
+ IPython
8
+ arch
requirements_dev.txt ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pandas
2
+ numpy
3
+ matplotlib
4
+ statsmodels
5
+ seaborn
6
+ IPython
7
+ arch
8
+
9
+ # Development Requirements -
10
+ tox==3.25.1
11
+ black==22.8.0
12
+ flake8>=5.0.4
13
+ pytest>=7.1.3
14
+ mypy>=0.971
15
+
16
+ -e .
setup.cfg ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [metadata]
2
+ license = MIT
3
+ license_file = LICENSE
4
+ classifiers =
5
+ Programming Language :: Python :: 3.8
6
+ Programming Language :: Python :: 3.9
7
+ Programming Language :: Python :: 3.10
8
+ Operating System :: OS Independent
9
+
10
+ [options]
11
+ install_requires =
12
+ ensure>=1.0.2
13
+ pandas>=2.0.2
14
+ numpy>=1.24.4
15
+ matplotlib>=3.7.5
16
+ statsmodels>=0.14.1
17
+ arch
18
+
19
+ python_requires = >=3.8
20
+
21
+ [options.extras_require]
22
+ testing =
23
+ pytest>=7.1.3
24
+ mypy>=0.971
25
+ flake8>=5.0.4
26
+ tox>=3.25.1
27
+ black>=22.8.0
28
+
29
+ [options.package_data]
30
+ dynamicts=py.typed
31
+
32
+ [flake8]
33
+ max-line-length = 160
34
+ exclude = __init__.py
setup.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from setuptools import setup, find_packages
2
+ from typing import List
3
+
4
+ with open("README.md", "r", encoding='utf-8') as f:
5
+ long_description = f.read()
6
+
7
+ __version__ = "0.1.9"
8
+ REPO_NAME = "DynamicTS"
9
+ PACKAGE_NAME = "dynamicts"
10
+ ORGANISATION_USERNAME = "Chinar-Quantum-AI-Ltd"
11
+ ORGANISATION_EMAIL = "[email protected]"
12
+
13
+
14
+ setup(
15
+ name=PACKAGE_NAME,
16
+ version=__version__,
17
+ description='A library for time series analysis and preprocessing',
18
+ author=ORGANISATION_USERNAME,
19
+ author_email=ORGANISATION_EMAIL,
20
+ long_description=long_description,
21
+ long_description_content_type="text/markdown",
22
+ url=f"https://github.com/{ORGANISATION_USERNAME}/{REPO_NAME}",
23
+ project_urls={
24
+ "Issue Tracker": f"https://github.com/{ORGANISATION_USERNAME}/{REPO_NAME}/issues",
25
+ },
26
+ package_dir={"": "."},
27
+ packages=find_packages(include=["dynamicts"]),
28
+ )
smoothing.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ smoothing.py
3
+ Simple exponential smoothing and plotting for time series data.
4
+ """
5
+
6
+ import pandas as pd
7
+ import numpy as np
8
+ import matplotlib.pyplot as plt
9
+ from statsmodels.tsa.holtwinters import SimpleExpSmoothing
10
+
11
+ def simple_exponential_smoothing(series, smoothing_level=None, optimized=True):
12
+ """Apply Simple Exponential Smoothing to a pandas Series."""
13
+ model = SimpleExpSmoothing(series.dropna())
14
+ fit = model.fit(smoothing_level=smoothing_level, optimized=optimized)
15
+ return fit.fittedvalues, fit
16
+
17
+ def plot_ses(series, smoothing_level=None, optimized=True, title='Simple Exponential Smoothing'):
18
+ """Plot original series and SES smoothed series."""
19
+ fitted_values, _ = simple_exponential_smoothing(series, smoothing_level, optimized)
20
+ plt.figure(figsize=(10,6))
21
+ plt.plot(series, label='Original', color='blue')
22
+ plt.plot(fitted_values, label='SES Smoothed', color='green')
23
+ plt.title(title)
24
+ plt.legend(loc='best')
25
+ plt.show()
tox.ini ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Define which python envirnments tox should test against
2
+ [tox]
3
+ envlist = py38, py39, py310
4
+ isolated_build = True
5
+
6
+ # Here we map Github Actions Python versions to tox environment
7
+ [gh-actions]
8
+ python =
9
+ 3.8: py38
10
+ 3.9: py39
11
+ 3.10: py310
12
+
13
+ [testenv]
14
+ deps = -rrequirements_dev.txt
15
+ commands =
16
+ # Runs flake8 to report syntax errors & undefined names
17
+ flake8 dynamicts --count --select=E9,F63,F7,F82 --show-source --statistics
18
+ # Runs flake8 again to report all issues but exit with 0 (won’t fail build)
19
+ flake8 dynamicts --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
20
+ # Runs static type checking with mypy on dynamicts package
21
+ ; mypy dynamicts
22
+ # Runs unit tests in verbose mode using pytest.
23
+ pytest -v tests/unit
24
+ pytest -v tests/integration