PyDTMC 10.1.0__tar.gz → 11.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.
- {pydtmc-10.1.0 → pydtmc-11.0.0}/PKG-INFO +7 -14
- {pydtmc-10.1.0 → pydtmc-11.0.0}/PyDTMC.egg-info/PKG-INFO +7 -14
- {pydtmc-10.1.0 → pydtmc-11.0.0}/PyDTMC.egg-info/SOURCES.txt +29 -15
- {pydtmc-10.1.0 → pydtmc-11.0.0}/PyDTMC.egg-info/requires.txt +0 -1
- {pydtmc-10.1.0 → pydtmc-11.0.0}/README.md +6 -12
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/advanced_topics/hidden_markov_models.rst +1 -1
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/advanced_topics/hitting_passage.rst +6 -10
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/advanced_topics/reduction_aggregation.rst +1 -1
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/api_reference/hidden_markov_model_methods_instance.rst +8 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/api_reference/hidden_markov_model_methods_static.rst +3 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/api_reference/hidden_markov_model_properties.rst +4 -1
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/api_reference/index.rst +4 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/api_reference/markov_chain_methods_instance.rst +13 -3
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/api_reference/markov_chain_methods_static.rst +11 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/api_reference/markov_chain_properties.rst +3 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/api_reference/other_assessment_functions.rst +1 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/api_reference/other_comparison_functions.rst +2 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/api_reference/other_plotting_functions.rst +5 -1
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/conf.py +1 -4
- {pydtmc-10.1.0 → pydtmc-11.0.0}/pydtmc/__init__.py +17 -3
- pydtmc-11.0.0/pydtmc/_analysis.py +2572 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/pydtmc/_base_classes.py +4 -8
- pydtmc-11.0.0/pydtmc/_custom_types.py +466 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/pydtmc/_decorators.py +7 -7
- {pydtmc-10.1.0 → pydtmc-11.0.0}/pydtmc/_dynamics.py +42 -50
- {pydtmc-10.1.0 → pydtmc-11.0.0}/pydtmc/_files_io.py +17 -19
- {pydtmc-10.1.0 → pydtmc-11.0.0}/pydtmc/_fitting.py +115 -139
- pydtmc-11.0.0/pydtmc/_generators.py +2135 -0
- pydtmc-11.0.0/pydtmc/_numerical.py +599 -0
- pydtmc-11.0.0/pydtmc/_rendering.py +2152 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/pydtmc/_utilities.py +70 -85
- {pydtmc-10.1.0 → pydtmc-11.0.0}/pydtmc/_validation.py +499 -396
- {pydtmc-10.1.0 → pydtmc-11.0.0}/pydtmc/assessments.py +177 -125
- pydtmc-11.0.0/pydtmc/comparisons.py +332 -0
- pydtmc-11.0.0/pydtmc/hidden_markov_model.py +1706 -0
- pydtmc-11.0.0/pydtmc/markov_chain.py +4480 -0
- pydtmc-11.0.0/pydtmc/plotting.py +535 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/setup.cfg +6 -8
- {pydtmc-10.1.0 → pydtmc-11.0.0}/setup.py +2 -2
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/benchmarks.py +3 -3
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/conftest.py +28 -20
- pydtmc-11.0.0/tests/fixtures/fixtures_aliases.json +279 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/fixtures/fixtures_assessments.json +231 -139
- pydtmc-11.0.0/tests/fixtures/fixtures_comparisons.json +802 -0
- pydtmc-11.0.0/tests/fixtures/fixtures_hmm.json +5548 -0
- pydtmc-11.0.0/tests/fixtures/fixtures_hmm_classification.json +150 -0
- pydtmc-11.0.0/tests/fixtures/fixtures_hmm_dynamics.json +2537 -0
- pydtmc-11.0.0/tests/fixtures/fixtures_hmm_fitting.json +617 -0
- pydtmc-11.0.0/tests/fixtures/fixtures_hmm_generators_instance.json +329 -0
- pydtmc-11.0.0/tests/fixtures/fixtures_hmm_generators_static.json +795 -0
- pydtmc-11.0.0/tests/fixtures/fixtures_hmm_measures.json +1810 -0
- pydtmc-11.0.0/tests/fixtures/fixtures_hmm_properties.json +444 -0
- pydtmc-11.0.0/tests/fixtures/fixtures_mc_classification.json +208 -0
- pydtmc-10.1.0/tests/fixtures/fixtures_dynamics.json → pydtmc-11.0.0/tests/fixtures/fixtures_mc_dynamics.json +540 -156
- pydtmc-11.0.0/tests/fixtures/fixtures_mc_fitting.json +420 -0
- pydtmc-10.1.0/tests/fixtures/fixtures_generators_instance.json → pydtmc-11.0.0/tests/fixtures/fixtures_mc_generators_instance.json +866 -0
- pydtmc-10.1.0/tests/fixtures/fixtures_generators_static.json → pydtmc-11.0.0/tests/fixtures/fixtures_mc_generators_static.json +1193 -135
- pydtmc-11.0.0/tests/fixtures/fixtures_mc_measures.json +8114 -0
- pydtmc-10.1.0/tests/fixtures/fixtures_properties.json → pydtmc-11.0.0/tests/fixtures/fixtures_mc_properties.json +506 -1
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/fixtures/fixtures_plotting.json +29 -4
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/fixtures/fixtures_utilities.json +107 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/fixtures/fixtures_validation.json +3180 -1169
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/test_aliases.py +97 -6
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/test_assessments.py +34 -25
- pydtmc-11.0.0/tests/test_comparisons.py +142 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/test_conversions.py +7 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/test_decorators.py +26 -1
- pydtmc-11.0.0/tests/test_hmm_classification.py +26 -0
- pydtmc-11.0.0/tests/test_hmm_dynamics.py +257 -0
- pydtmc-11.0.0/tests/test_hmm_fitting.py +228 -0
- pydtmc-11.0.0/tests/test_hmm_generators_instance.py +57 -0
- pydtmc-11.0.0/tests/test_hmm_generators_static.py +141 -0
- pydtmc-11.0.0/tests/test_hmm_measures.py +174 -0
- pydtmc-11.0.0/tests/test_hmm_properties.py +145 -0
- pydtmc-10.1.0/tests/test_classification.py → pydtmc-11.0.0/tests/test_mc_classification.py +24 -0
- pydtmc-10.1.0/tests/test_dynamics.py → pydtmc-11.0.0/tests/test_mc_dynamics.py +3 -3
- pydtmc-10.1.0/tests/test_fitting.py → pydtmc-11.0.0/tests/test_mc_fitting.py +8 -2
- pydtmc-11.0.0/tests/test_mc_generators_instance.py +482 -0
- pydtmc-11.0.0/tests/test_mc_generators_static.py +338 -0
- pydtmc-10.1.0/tests/test_measures.py → pydtmc-11.0.0/tests/test_mc_measures.py +172 -23
- pydtmc-10.1.0/tests/test_properties.py → pydtmc-11.0.0/tests/test_mc_properties.py +105 -14
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/test_plotting.py +118 -110
- pydtmc-11.0.0/tests/test_utilities.py +206 -0
- pydtmc-11.0.0/tests/test_validation.py +690 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/utilities.py +20 -2
- pydtmc-10.1.0/pydtmc/_analysis.py +0 -1700
- pydtmc-10.1.0/pydtmc/_custom_types.py +0 -386
- pydtmc-10.1.0/pydtmc/_generators.py +0 -1435
- pydtmc-10.1.0/pydtmc/_numerical.py +0 -408
- pydtmc-10.1.0/pydtmc/comparisons.py +0 -195
- pydtmc-10.1.0/pydtmc/hidden_markov_model.py +0 -1445
- pydtmc-10.1.0/pydtmc/markov_chain.py +0 -3772
- pydtmc-10.1.0/pydtmc/plotting.py +0 -1634
- pydtmc-10.1.0/tests/fixtures/fixtures_aliases.json +0 -105
- pydtmc-10.1.0/tests/fixtures/fixtures_classification.json +0 -92
- pydtmc-10.1.0/tests/fixtures/fixtures_comparisons.json +0 -407
- pydtmc-10.1.0/tests/fixtures/fixtures_fitting.json +0 -216
- pydtmc-10.1.0/tests/fixtures/fixtures_hmm.json +0 -3371
- pydtmc-10.1.0/tests/fixtures/fixtures_measures.json +0 -3623
- pydtmc-10.1.0/tests/test_comparisons.py +0 -84
- pydtmc-10.1.0/tests/test_generators_instance.py +0 -276
- pydtmc-10.1.0/tests/test_generators_static.py +0 -138
- pydtmc-10.1.0/tests/test_hmm.py +0 -595
- pydtmc-10.1.0/tests/test_utilities.py +0 -55
- pydtmc-10.1.0/tests/test_validation.py +0 -922
- {pydtmc-10.1.0 → pydtmc-11.0.0}/LICENSE.md +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/MANIFEST.in +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/PyDTMC.egg-info/dependency_links.txt +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/PyDTMC.egg-info/top_level.txt +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/data/empty +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/Makefile +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/build/empty +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/make.bat +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/_static/css/style.css +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/_templates/empty +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/advanced_topics/absorbing_markov_chains.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/advanced_topics/assessments.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/advanced_topics/chain_comparison.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/advanced_topics/index.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/advanced_topics/long_term_behavior.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/advanced_topics/markov_chain_analysis.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/advanced_topics/mixing_convergence.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/advanced_topics/simulation_empirical_analysis.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/advanced_topics/transition_paths_analysis.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/advanced_topics/visualization.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/api_reference/custom_exceptions.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/api_reference/hidden_markov_model.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/api_reference/markov_chain.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/genindex.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/getting_started/first_hidden_markov_model.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/getting_started/first_markov_chain.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/getting_started/index.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/getting_started/installation.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/index.rst +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/pydtmc/_constants.py +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/pydtmc/exceptions.py +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/pyproject.toml +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/requirements.txt +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/__init__.py +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/files/file_empty.txt +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/files/file_filled.txt +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/files/file_noext +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/fixtures/fixtures_benchmarks.json +0 -0
- {pydtmc-10.1.0 → pydtmc-11.0.0}/tests/fixtures/fixtures_conversions.json +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyDTMC
|
|
3
|
-
Version:
|
|
3
|
+
Version: 11.0.0
|
|
4
4
|
Summary: Python library for analyzing, simulating, and visualizing discrete-time Markov chains and hidden Markov models.
|
|
5
5
|
Home-page: https://github.com/TommasoBelluzzo/PyDTMC
|
|
6
6
|
Author: Tommaso Belluzzo
|
|
@@ -56,7 +56,6 @@ Requires-Dist: flake8; extra == "lint"
|
|
|
56
56
|
Requires-Dist: pylint; extra == "lint"
|
|
57
57
|
Provides-Extra: package
|
|
58
58
|
Requires-Dist: defusedxml; extra == "package"
|
|
59
|
-
Requires-Dist: numpydoc; extra == "package"
|
|
60
59
|
Requires-Dist: pandas; extra == "package"
|
|
61
60
|
Requires-Dist: pydot; extra == "package"
|
|
62
61
|
Provides-Extra: tests
|
|
@@ -84,7 +83,7 @@ PyDTMC is a lightweight Python library focused on discrete-time Markov chains an
|
|
|
84
83
|
<td align="right">Info:</td>
|
|
85
84
|
<td align="left">
|
|
86
85
|
<a href="https://github.com/TommasoBelluzzo/PyDTMC/blob/master/LICENSE.md"><img alt="License" src="https://img.shields.io/github/license/TommasoBelluzzo/PyDTMC?style=flat&label=License&color=1081C2"/></a>
|
|
87
|
-
<a href="https://doi.org/10.5281/zenodo.
|
|
86
|
+
<a href="https://doi.org/10.5281/zenodo.23423407"><img alt="DOI" src="https://zenodo.org/badge/DOI/10.5281/zenodo.23423407.svg"/></a>
|
|
88
87
|
<a href="#"><img alt="Size" src="https://img.shields.io/github/repo-size/TommasoBelluzzo/PyDTMC?style=flat&label=Size&color=1081C2"/></a>
|
|
89
88
|
</td>
|
|
90
89
|
</tr>
|
|
@@ -106,12 +105,6 @@ PyDTMC is a lightweight Python library focused on discrete-time Markov chains an
|
|
|
106
105
|
<a href="https://anaconda.org/conda-forge/pydtmc/"><img alt="Downloads" src="https://img.shields.io/conda/dn/conda-forge/pydtmc?style=flat&label=Downloads&color=1081C2"/></a>
|
|
107
106
|
</td>
|
|
108
107
|
</tr>
|
|
109
|
-
<tr>
|
|
110
|
-
<td align="right">Donation:</td>
|
|
111
|
-
<td align="left">
|
|
112
|
-
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=D8LH6DNYN7EN8"><img alt="PayPal" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif"/></a>
|
|
113
|
-
</td>
|
|
114
|
-
</tr>
|
|
115
108
|
</table>
|
|
116
109
|
|
|
117
110
|
## Installation
|
|
@@ -142,7 +135,7 @@ pip install git+https://github.com/TommasoBelluzzo/PyDTMC.git
|
|
|
142
135
|
|
|
143
136
|
For additional functionality, mathematical definitions, and usage examples, refer to the [documentation](https://pydtmc.readthedocs.io/).
|
|
144
137
|
|
|
145
|
-
If you use PyDTMC in your work, please cite the software using its [Zenodo DOI](https://doi.org/10.5281/zenodo.
|
|
138
|
+
If you use PyDTMC in your work, please cite the software using its [Zenodo DOI](https://doi.org/10.5281/zenodo.23423407).\
|
|
146
139
|
Citation metadata is also available in the [CITATION.cff](https://github.com/TommasoBelluzzo/PyDTMC/blob/master/CITATION.cff) file.
|
|
147
140
|
|
|
148
141
|
## Quick Start
|
|
@@ -203,18 +196,18 @@ print(mc.entropy_rate)
|
|
|
203
196
|
print(mc.absorption_probabilities())
|
|
204
197
|
print(mc.expected_rewards(10, [2.0, -3.0, 8.0, -7.0]))
|
|
205
198
|
print(mc.expected_transitions(2))
|
|
199
|
+
print(mc.expected_visits())
|
|
206
200
|
print(mc.first_passage_probabilities(5, 3))
|
|
207
201
|
print(mc.hitting_probabilities([0, 1]))
|
|
208
|
-
print(mc.mean_number_visits())
|
|
209
202
|
print(mc.simulate(10, seed=32))
|
|
210
203
|
```
|
|
211
204
|
|
|
212
205
|
**Visualization**
|
|
213
206
|
|
|
214
207
|
```python
|
|
215
|
-
from pydtmc import
|
|
208
|
+
from pydtmc import plot_graph, plot_redistributions, plot_sequence, plot_spectrum
|
|
216
209
|
|
|
217
|
-
|
|
210
|
+
plot_spectrum(mc, dpi=300)
|
|
218
211
|
plot_graph(mc, dpi=300)
|
|
219
212
|
plot_sequence(mc, 10, plot_type='histogram', dpi=300)
|
|
220
213
|
plot_sequence(mc, 10, plot_type='heatmap', dpi=300)
|
|
@@ -243,7 +236,7 @@ print(hmm.pi)
|
|
|
243
236
|
print(hmm.emission_probability('H1', 'A'))
|
|
244
237
|
print(hmm.transition_probability('A', 'B'))
|
|
245
238
|
print(hmm.decode(['H1', 'H2', 'H3']))
|
|
246
|
-
print(hmm.predict('
|
|
239
|
+
print(hmm.predict('vit', ['H1', 'H2', 'H3']))
|
|
247
240
|
print(hmm.simulate(12, seed=1488))
|
|
248
241
|
```
|
|
249
242
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyDTMC
|
|
3
|
-
Version:
|
|
3
|
+
Version: 11.0.0
|
|
4
4
|
Summary: Python library for analyzing, simulating, and visualizing discrete-time Markov chains and hidden Markov models.
|
|
5
5
|
Home-page: https://github.com/TommasoBelluzzo/PyDTMC
|
|
6
6
|
Author: Tommaso Belluzzo
|
|
@@ -56,7 +56,6 @@ Requires-Dist: flake8; extra == "lint"
|
|
|
56
56
|
Requires-Dist: pylint; extra == "lint"
|
|
57
57
|
Provides-Extra: package
|
|
58
58
|
Requires-Dist: defusedxml; extra == "package"
|
|
59
|
-
Requires-Dist: numpydoc; extra == "package"
|
|
60
59
|
Requires-Dist: pandas; extra == "package"
|
|
61
60
|
Requires-Dist: pydot; extra == "package"
|
|
62
61
|
Provides-Extra: tests
|
|
@@ -84,7 +83,7 @@ PyDTMC is a lightweight Python library focused on discrete-time Markov chains an
|
|
|
84
83
|
<td align="right">Info:</td>
|
|
85
84
|
<td align="left">
|
|
86
85
|
<a href="https://github.com/TommasoBelluzzo/PyDTMC/blob/master/LICENSE.md"><img alt="License" src="https://img.shields.io/github/license/TommasoBelluzzo/PyDTMC?style=flat&label=License&color=1081C2"/></a>
|
|
87
|
-
<a href="https://doi.org/10.5281/zenodo.
|
|
86
|
+
<a href="https://doi.org/10.5281/zenodo.23423407"><img alt="DOI" src="https://zenodo.org/badge/DOI/10.5281/zenodo.23423407.svg"/></a>
|
|
88
87
|
<a href="#"><img alt="Size" src="https://img.shields.io/github/repo-size/TommasoBelluzzo/PyDTMC?style=flat&label=Size&color=1081C2"/></a>
|
|
89
88
|
</td>
|
|
90
89
|
</tr>
|
|
@@ -106,12 +105,6 @@ PyDTMC is a lightweight Python library focused on discrete-time Markov chains an
|
|
|
106
105
|
<a href="https://anaconda.org/conda-forge/pydtmc/"><img alt="Downloads" src="https://img.shields.io/conda/dn/conda-forge/pydtmc?style=flat&label=Downloads&color=1081C2"/></a>
|
|
107
106
|
</td>
|
|
108
107
|
</tr>
|
|
109
|
-
<tr>
|
|
110
|
-
<td align="right">Donation:</td>
|
|
111
|
-
<td align="left">
|
|
112
|
-
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=D8LH6DNYN7EN8"><img alt="PayPal" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif"/></a>
|
|
113
|
-
</td>
|
|
114
|
-
</tr>
|
|
115
108
|
</table>
|
|
116
109
|
|
|
117
110
|
## Installation
|
|
@@ -142,7 +135,7 @@ pip install git+https://github.com/TommasoBelluzzo/PyDTMC.git
|
|
|
142
135
|
|
|
143
136
|
For additional functionality, mathematical definitions, and usage examples, refer to the [documentation](https://pydtmc.readthedocs.io/).
|
|
144
137
|
|
|
145
|
-
If you use PyDTMC in your work, please cite the software using its [Zenodo DOI](https://doi.org/10.5281/zenodo.
|
|
138
|
+
If you use PyDTMC in your work, please cite the software using its [Zenodo DOI](https://doi.org/10.5281/zenodo.23423407).\
|
|
146
139
|
Citation metadata is also available in the [CITATION.cff](https://github.com/TommasoBelluzzo/PyDTMC/blob/master/CITATION.cff) file.
|
|
147
140
|
|
|
148
141
|
## Quick Start
|
|
@@ -203,18 +196,18 @@ print(mc.entropy_rate)
|
|
|
203
196
|
print(mc.absorption_probabilities())
|
|
204
197
|
print(mc.expected_rewards(10, [2.0, -3.0, 8.0, -7.0]))
|
|
205
198
|
print(mc.expected_transitions(2))
|
|
199
|
+
print(mc.expected_visits())
|
|
206
200
|
print(mc.first_passage_probabilities(5, 3))
|
|
207
201
|
print(mc.hitting_probabilities([0, 1]))
|
|
208
|
-
print(mc.mean_number_visits())
|
|
209
202
|
print(mc.simulate(10, seed=32))
|
|
210
203
|
```
|
|
211
204
|
|
|
212
205
|
**Visualization**
|
|
213
206
|
|
|
214
207
|
```python
|
|
215
|
-
from pydtmc import
|
|
208
|
+
from pydtmc import plot_graph, plot_redistributions, plot_sequence, plot_spectrum
|
|
216
209
|
|
|
217
|
-
|
|
210
|
+
plot_spectrum(mc, dpi=300)
|
|
218
211
|
plot_graph(mc, dpi=300)
|
|
219
212
|
plot_sequence(mc, 10, plot_type='histogram', dpi=300)
|
|
220
213
|
plot_sequence(mc, 10, plot_type='heatmap', dpi=300)
|
|
@@ -243,7 +236,7 @@ print(hmm.pi)
|
|
|
243
236
|
print(hmm.emission_probability('H1', 'A'))
|
|
244
237
|
print(hmm.transition_probability('A', 'B'))
|
|
245
238
|
print(hmm.decode(['H1', 'H2', 'H3']))
|
|
246
|
-
print(hmm.predict('
|
|
239
|
+
print(hmm.predict('vit', ['H1', 'H2', 'H3']))
|
|
247
240
|
print(hmm.simulate(12, seed=1488))
|
|
248
241
|
```
|
|
249
242
|
|
|
@@ -60,6 +60,7 @@ pydtmc/_files_io.py
|
|
|
60
60
|
pydtmc/_fitting.py
|
|
61
61
|
pydtmc/_generators.py
|
|
62
62
|
pydtmc/_numerical.py
|
|
63
|
+
pydtmc/_rendering.py
|
|
63
64
|
pydtmc/_utilities.py
|
|
64
65
|
pydtmc/_validation.py
|
|
65
66
|
pydtmc/assessments.py
|
|
@@ -73,18 +74,24 @@ tests/benchmarks.py
|
|
|
73
74
|
tests/conftest.py
|
|
74
75
|
tests/test_aliases.py
|
|
75
76
|
tests/test_assessments.py
|
|
76
|
-
tests/test_classification.py
|
|
77
77
|
tests/test_comparisons.py
|
|
78
78
|
tests/test_conversions.py
|
|
79
79
|
tests/test_decorators.py
|
|
80
|
-
tests/
|
|
81
|
-
tests/
|
|
82
|
-
tests/
|
|
83
|
-
tests/
|
|
84
|
-
tests/
|
|
85
|
-
tests/
|
|
80
|
+
tests/test_hmm_classification.py
|
|
81
|
+
tests/test_hmm_dynamics.py
|
|
82
|
+
tests/test_hmm_fitting.py
|
|
83
|
+
tests/test_hmm_generators_instance.py
|
|
84
|
+
tests/test_hmm_generators_static.py
|
|
85
|
+
tests/test_hmm_measures.py
|
|
86
|
+
tests/test_hmm_properties.py
|
|
87
|
+
tests/test_mc_classification.py
|
|
88
|
+
tests/test_mc_dynamics.py
|
|
89
|
+
tests/test_mc_fitting.py
|
|
90
|
+
tests/test_mc_generators_instance.py
|
|
91
|
+
tests/test_mc_generators_static.py
|
|
92
|
+
tests/test_mc_measures.py
|
|
93
|
+
tests/test_mc_properties.py
|
|
86
94
|
tests/test_plotting.py
|
|
87
|
-
tests/test_properties.py
|
|
88
95
|
tests/test_utilities.py
|
|
89
96
|
tests/test_validation.py
|
|
90
97
|
tests/utilities.py
|
|
@@ -94,16 +101,23 @@ tests/files/file_noext
|
|
|
94
101
|
tests/fixtures/fixtures_aliases.json
|
|
95
102
|
tests/fixtures/fixtures_assessments.json
|
|
96
103
|
tests/fixtures/fixtures_benchmarks.json
|
|
97
|
-
tests/fixtures/fixtures_classification.json
|
|
98
104
|
tests/fixtures/fixtures_comparisons.json
|
|
99
105
|
tests/fixtures/fixtures_conversions.json
|
|
100
|
-
tests/fixtures/fixtures_dynamics.json
|
|
101
|
-
tests/fixtures/fixtures_fitting.json
|
|
102
|
-
tests/fixtures/fixtures_generators_instance.json
|
|
103
|
-
tests/fixtures/fixtures_generators_static.json
|
|
104
106
|
tests/fixtures/fixtures_hmm.json
|
|
105
|
-
tests/fixtures/
|
|
107
|
+
tests/fixtures/fixtures_hmm_classification.json
|
|
108
|
+
tests/fixtures/fixtures_hmm_dynamics.json
|
|
109
|
+
tests/fixtures/fixtures_hmm_fitting.json
|
|
110
|
+
tests/fixtures/fixtures_hmm_generators_instance.json
|
|
111
|
+
tests/fixtures/fixtures_hmm_generators_static.json
|
|
112
|
+
tests/fixtures/fixtures_hmm_measures.json
|
|
113
|
+
tests/fixtures/fixtures_hmm_properties.json
|
|
114
|
+
tests/fixtures/fixtures_mc_classification.json
|
|
115
|
+
tests/fixtures/fixtures_mc_dynamics.json
|
|
116
|
+
tests/fixtures/fixtures_mc_fitting.json
|
|
117
|
+
tests/fixtures/fixtures_mc_generators_instance.json
|
|
118
|
+
tests/fixtures/fixtures_mc_generators_static.json
|
|
119
|
+
tests/fixtures/fixtures_mc_measures.json
|
|
120
|
+
tests/fixtures/fixtures_mc_properties.json
|
|
106
121
|
tests/fixtures/fixtures_plotting.json
|
|
107
|
-
tests/fixtures/fixtures_properties.json
|
|
108
122
|
tests/fixtures/fixtures_utilities.json
|
|
109
123
|
tests/fixtures/fixtures_validation.json
|
|
@@ -15,7 +15,7 @@ PyDTMC is a lightweight Python library focused on discrete-time Markov chains an
|
|
|
15
15
|
<td align="right">Info:</td>
|
|
16
16
|
<td align="left">
|
|
17
17
|
<a href="https://github.com/TommasoBelluzzo/PyDTMC/blob/master/LICENSE.md"><img alt="License" src="https://img.shields.io/github/license/TommasoBelluzzo/PyDTMC?style=flat&label=License&color=1081C2"/></a>
|
|
18
|
-
<a href="https://doi.org/10.5281/zenodo.
|
|
18
|
+
<a href="https://doi.org/10.5281/zenodo.23423407"><img alt="DOI" src="https://zenodo.org/badge/DOI/10.5281/zenodo.23423407.svg"/></a>
|
|
19
19
|
<a href="#"><img alt="Size" src="https://img.shields.io/github/repo-size/TommasoBelluzzo/PyDTMC?style=flat&label=Size&color=1081C2"/></a>
|
|
20
20
|
</td>
|
|
21
21
|
</tr>
|
|
@@ -37,12 +37,6 @@ PyDTMC is a lightweight Python library focused on discrete-time Markov chains an
|
|
|
37
37
|
<a href="https://anaconda.org/conda-forge/pydtmc/"><img alt="Downloads" src="https://img.shields.io/conda/dn/conda-forge/pydtmc?style=flat&label=Downloads&color=1081C2"/></a>
|
|
38
38
|
</td>
|
|
39
39
|
</tr>
|
|
40
|
-
<tr>
|
|
41
|
-
<td align="right">Donation:</td>
|
|
42
|
-
<td align="left">
|
|
43
|
-
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=D8LH6DNYN7EN8"><img alt="PayPal" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif"/></a>
|
|
44
|
-
</td>
|
|
45
|
-
</tr>
|
|
46
40
|
</table>
|
|
47
41
|
|
|
48
42
|
## Installation
|
|
@@ -73,7 +67,7 @@ pip install git+https://github.com/TommasoBelluzzo/PyDTMC.git
|
|
|
73
67
|
|
|
74
68
|
For additional functionality, mathematical definitions, and usage examples, refer to the [documentation](https://pydtmc.readthedocs.io/).
|
|
75
69
|
|
|
76
|
-
If you use PyDTMC in your work, please cite the software using its [Zenodo DOI](https://doi.org/10.5281/zenodo.
|
|
70
|
+
If you use PyDTMC in your work, please cite the software using its [Zenodo DOI](https://doi.org/10.5281/zenodo.23423407).\
|
|
77
71
|
Citation metadata is also available in the [CITATION.cff](https://github.com/TommasoBelluzzo/PyDTMC/blob/master/CITATION.cff) file.
|
|
78
72
|
|
|
79
73
|
## Quick Start
|
|
@@ -134,18 +128,18 @@ print(mc.entropy_rate)
|
|
|
134
128
|
print(mc.absorption_probabilities())
|
|
135
129
|
print(mc.expected_rewards(10, [2.0, -3.0, 8.0, -7.0]))
|
|
136
130
|
print(mc.expected_transitions(2))
|
|
131
|
+
print(mc.expected_visits())
|
|
137
132
|
print(mc.first_passage_probabilities(5, 3))
|
|
138
133
|
print(mc.hitting_probabilities([0, 1]))
|
|
139
|
-
print(mc.mean_number_visits())
|
|
140
134
|
print(mc.simulate(10, seed=32))
|
|
141
135
|
```
|
|
142
136
|
|
|
143
137
|
**Visualization**
|
|
144
138
|
|
|
145
139
|
```python
|
|
146
|
-
from pydtmc import
|
|
140
|
+
from pydtmc import plot_graph, plot_redistributions, plot_sequence, plot_spectrum
|
|
147
141
|
|
|
148
|
-
|
|
142
|
+
plot_spectrum(mc, dpi=300)
|
|
149
143
|
plot_graph(mc, dpi=300)
|
|
150
144
|
plot_sequence(mc, 10, plot_type='histogram', dpi=300)
|
|
151
145
|
plot_sequence(mc, 10, plot_type='heatmap', dpi=300)
|
|
@@ -174,7 +168,7 @@ print(hmm.pi)
|
|
|
174
168
|
print(hmm.emission_probability('H1', 'A'))
|
|
175
169
|
print(hmm.transition_probability('A', 'B'))
|
|
176
170
|
print(hmm.decode(['H1', 'H2', 'H3']))
|
|
177
|
-
print(hmm.predict('
|
|
171
|
+
print(hmm.predict('vit', ['H1', 'H2', 'H3']))
|
|
178
172
|
print(hmm.simulate(12, seed=1488))
|
|
179
173
|
```
|
|
180
174
|
|
|
@@ -121,26 +121,22 @@ Commute Times
|
|
|
121
121
|
| The **commute time** between two states is the expected time to travel from one to the other and then return.
|
|
122
122
|
| Unlike a hitting time, it describes a complete round trip.
|
|
123
123
|
|
|
124
|
-
PyDTMC
|
|
124
|
+
PyDTMC can compute the mean commute time between two subsets of the state space:
|
|
125
125
|
|
|
126
126
|
.. code-block:: python
|
|
127
127
|
|
|
128
|
-
print(mc.
|
|
128
|
+
print(mc.commute_times_between('mean', ['Low'], ['High']))
|
|
129
129
|
|
|
130
|
-
The
|
|
130
|
+
The result is:
|
|
131
131
|
|
|
132
132
|
.. code-block:: text
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
[ 8.0, 0.0, 8.0]
|
|
136
|
-
[16.0, 8.0, 0.0]]
|
|
134
|
+
16.0
|
|
137
135
|
|
|
138
|
-
|
|
|
139
|
-
| For example, the value ``16.0`` represents the commute time between ``Low`` and ``High``.
|
|
136
|
+
| The value ``16.0`` represents the expected round-trip time between ``Low`` and ``High``.
|
|
140
137
|
| This includes eight expected steps to reach ``High`` and another eight to return to ``Low``.
|
|
141
|
-
| The matrix is symmetric because the round-trip time is the same in either direction.
|
|
142
138
|
|
|
143
|
-
|
|
139
|
+
For individual states, the mean commute time is symmetric and satisfies:
|
|
144
140
|
|
|
145
141
|
.. math::
|
|
146
142
|
|
|
@@ -98,7 +98,7 @@ The ``lump`` method constructs the reduced Markov chain from the partition:
|
|
|
98
98
|
|
|
99
99
|
| The resulting chain has two states, one for each group in the partition.
|
|
100
100
|
| Its transition probabilities agree with the reduced matrix above.
|
|
101
|
-
| Unlike
|
|
101
|
+
| Unlike spectral aggregation, valid lumping preserves the probabilities of transitions between groups within numerical tolerance.
|
|
102
102
|
|
|
103
103
|
Long-Term Behavior
|
|
104
104
|
------------------
|
{pydtmc-10.1.0 → pydtmc-11.0.0}/docs/source/api_reference/hidden_markov_model_methods_instance.rst
RENAMED
|
@@ -6,23 +6,31 @@ Instance Methods
|
|
|
6
6
|
.. autoclass:: HiddenMarkovModel
|
|
7
7
|
:noindex:
|
|
8
8
|
:members:
|
|
9
|
+
block_entropy,
|
|
9
10
|
conditional_probabilities,
|
|
10
11
|
decode,
|
|
12
|
+
emission_probabilities,
|
|
11
13
|
emission_probability,
|
|
12
14
|
entropy,
|
|
13
15
|
entropy_rate,
|
|
16
|
+
excess_entropy,
|
|
14
17
|
hitting_probabilities,
|
|
18
|
+
information_criterion,
|
|
15
19
|
mutual_information,
|
|
16
20
|
next,
|
|
17
21
|
perplexity,
|
|
18
22
|
predict,
|
|
19
23
|
predict_trajectory,
|
|
20
24
|
propagate,
|
|
25
|
+
residuals,
|
|
21
26
|
restrict,
|
|
22
27
|
sequence_probability,
|
|
23
28
|
simulate,
|
|
29
|
+
synchronization_entropy,
|
|
30
|
+
synchronization_information,
|
|
24
31
|
to_dictionary,
|
|
25
32
|
to_graph,
|
|
26
33
|
to_file,
|
|
27
34
|
to_matrices,
|
|
35
|
+
transition_probabilities,
|
|
28
36
|
transition_probability
|
|
@@ -3,6 +3,10 @@ API Reference
|
|
|
3
3
|
|
|
4
4
|
This section provides a detailed reference documentation for PyDTMC's public classes and functions.
|
|
5
5
|
|
|
6
|
+
.. note::
|
|
7
|
+
|
|
8
|
+
Unless otherwise specified, numerical type annotations such as ``int`` and ``float`` may also represent alternative scalar types, subject to runtime validation.
|
|
9
|
+
|
|
6
10
|
.. toctree::
|
|
7
11
|
:maxdepth: 1
|
|
8
12
|
:hidden:
|
|
@@ -12,24 +12,29 @@ Instance Methods
|
|
|
12
12
|
censor,
|
|
13
13
|
closest_reversible,
|
|
14
14
|
committor_probabilities,
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
commute_times_between,
|
|
16
|
+
commute_times_to,
|
|
17
|
+
compose_with,
|
|
17
18
|
conductance,
|
|
19
|
+
cumulants,
|
|
18
20
|
expected_rewards,
|
|
19
21
|
expected_transitions,
|
|
22
|
+
expected_visits,
|
|
20
23
|
first_passage_probabilities,
|
|
21
24
|
first_passage_reward,
|
|
22
25
|
first_passage_times_between,
|
|
23
26
|
first_passage_times_to,
|
|
27
|
+
fundamental_cycle_profile,
|
|
24
28
|
hitting_probabilities,
|
|
25
29
|
hitting_times,
|
|
30
|
+
information_criterion,
|
|
26
31
|
is_absorbing_state,
|
|
27
32
|
is_accessible,
|
|
28
33
|
is_cyclic_state,
|
|
29
34
|
is_recurrent_state,
|
|
30
35
|
is_transient_state,
|
|
36
|
+
large_deviation_rate,
|
|
31
37
|
lump,
|
|
32
|
-
mean_number_visits,
|
|
33
38
|
merge_with,
|
|
34
39
|
metastability,
|
|
35
40
|
metastable_aggregation,
|
|
@@ -41,9 +46,12 @@ Instance Methods
|
|
|
41
46
|
propagate,
|
|
42
47
|
reactive_density,
|
|
43
48
|
reactive_flux,
|
|
49
|
+
reactive_paths,
|
|
44
50
|
reaction_rate,
|
|
45
51
|
recurrence_times,
|
|
52
|
+
residuals,
|
|
46
53
|
reversibilize,
|
|
54
|
+
reweight,
|
|
47
55
|
sensitivity,
|
|
48
56
|
sequence_probability,
|
|
49
57
|
simulate,
|
|
@@ -51,6 +59,7 @@ Instance Methods
|
|
|
51
59
|
stationary_perturbation_bound,
|
|
52
60
|
stationary_sampling,
|
|
53
61
|
teleport,
|
|
62
|
+
temper,
|
|
54
63
|
time_correlations,
|
|
55
64
|
time_relaxations,
|
|
56
65
|
time_reversal,
|
|
@@ -63,4 +72,5 @@ Instance Methods
|
|
|
63
72
|
to_matrix,
|
|
64
73
|
to_nth_order,
|
|
65
74
|
to_subchain,
|
|
75
|
+
transition_probabilities,
|
|
66
76
|
transition_probability
|
|
@@ -7,8 +7,13 @@ Static Methods
|
|
|
7
7
|
:noindex:
|
|
8
8
|
:members:
|
|
9
9
|
approximation,
|
|
10
|
+
bernoulli_trials,
|
|
10
11
|
birth_death,
|
|
12
|
+
card_shuffling,
|
|
13
|
+
coupon_collector,
|
|
11
14
|
dirichlet_process,
|
|
15
|
+
epidemic_model,
|
|
16
|
+
exclusion_process,
|
|
12
17
|
fit_function,
|
|
13
18
|
fit_sequence,
|
|
14
19
|
from_dictionary,
|
|
@@ -16,8 +21,14 @@ Static Methods
|
|
|
16
21
|
from_file,
|
|
17
22
|
from_matrix,
|
|
18
23
|
gamblers_ruin,
|
|
24
|
+
gibbs_sampling,
|
|
19
25
|
identity,
|
|
26
|
+
ising_model,
|
|
27
|
+
metropolis_hastings,
|
|
28
|
+
pattern_matching,
|
|
20
29
|
population_genetics_model,
|
|
21
30
|
random,
|
|
22
31
|
random_distribution,
|
|
32
|
+
random_walk,
|
|
33
|
+
self_attention,
|
|
23
34
|
urn_model
|
|
@@ -22,6 +22,7 @@ Properties
|
|
|
22
22
|
entropy_production_rate,
|
|
23
23
|
entropy_rate,
|
|
24
24
|
entropy_rate_normalized,
|
|
25
|
+
fisher_information,
|
|
25
26
|
fundamental_matrix,
|
|
26
27
|
global_conductance,
|
|
27
28
|
global_metastability,
|
|
@@ -45,10 +46,12 @@ Properties
|
|
|
45
46
|
occupation_trace,
|
|
46
47
|
ordinary_spectral_gap,
|
|
47
48
|
p,
|
|
49
|
+
parameters,
|
|
48
50
|
period,
|
|
49
51
|
periods,
|
|
50
52
|
pi,
|
|
51
53
|
predictability,
|
|
54
|
+
predictability_gain,
|
|
52
55
|
rank,
|
|
53
56
|
recurrent_classes,
|
|
54
57
|
recurrent_states,
|
|
@@ -3,6 +3,8 @@ Comparison Functions
|
|
|
3
3
|
|
|
4
4
|
.. currentmodule:: pydtmc
|
|
5
5
|
|
|
6
|
+
.. autofunction:: calculate_first_passage_distance
|
|
6
7
|
.. autofunction:: calculate_stationary_distance
|
|
8
|
+
.. autofunction:: calculate_stationary_divergence
|
|
7
9
|
.. autofunction:: calculate_transition_distance
|
|
8
10
|
.. autofunction:: calculate_transition_divergence
|
|
@@ -5,10 +5,14 @@ Plotting Functions
|
|
|
5
5
|
|
|
6
6
|
.. autofunction:: plot_comparison
|
|
7
7
|
.. autofunction:: plot_convergence
|
|
8
|
-
.. autofunction::
|
|
8
|
+
.. autofunction:: plot_decoding
|
|
9
9
|
.. autofunction:: plot_flow
|
|
10
10
|
.. autofunction:: plot_graph
|
|
11
|
+
.. autofunction:: plot_implied_timescales
|
|
11
12
|
.. autofunction:: plot_matrix
|
|
13
|
+
.. autofunction:: plot_posterior
|
|
12
14
|
.. autofunction:: plot_redistributions
|
|
15
|
+
.. autofunction:: plot_residuals
|
|
13
16
|
.. autofunction:: plot_sequence
|
|
17
|
+
.. autofunction:: plot_spectrum
|
|
14
18
|
.. autofunction:: plot_trellis
|
|
@@ -20,9 +20,6 @@ import sphinx.addnodes as _san
|
|
|
20
20
|
import sphinx.ext.intersphinx as _spei
|
|
21
21
|
import sphinx.transforms.post_transforms as _sppt
|
|
22
22
|
|
|
23
|
-
# noinspection PyUnresolvedReferences
|
|
24
|
-
import sphinx_rtd_theme # noqa
|
|
25
|
-
|
|
26
23
|
try:
|
|
27
24
|
from sphinx_autodoc_typehints import format_annotation as _format_annotation
|
|
28
25
|
except ImportError:
|
|
@@ -44,7 +41,7 @@ _sys.path.insert(0, _osp.abspath('../..'))
|
|
|
44
41
|
_base_directory = _osp.abspath(_osp.dirname(__file__))
|
|
45
42
|
_init_file = _osp.join(_base_directory, '../../pydtmc/__init__.py')
|
|
46
43
|
|
|
47
|
-
with open(_init_file, 'r') as _file:
|
|
44
|
+
with open(_init_file, mode='r', encoding='utf-8') as _file:
|
|
48
45
|
|
|
49
46
|
_file_content = _file.read()
|
|
50
47
|
|