xpyrment 1.1.2.5__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 (178) hide show
  1. xpyrment-1.1.2.5/LICENSE +29 -0
  2. xpyrment-1.1.2.5/PKG-INFO +416 -0
  3. xpyrment-1.1.2.5/README.md +372 -0
  4. xpyrment-1.1.2.5/pyproject.toml +90 -0
  5. xpyrment-1.1.2.5/setup.cfg +4 -0
  6. xpyrment-1.1.2.5/src/xpyrment/__init__.py +62 -0
  7. xpyrment-1.1.2.5/src/xpyrment/_version.py +1 -0
  8. xpyrment-1.1.2.5/src/xpyrment/analyze/__init__.py +60 -0
  9. xpyrment-1.1.2.5/src/xpyrment/analyze/confounding.py +103 -0
  10. xpyrment-1.1.2.5/src/xpyrment/analyze/copula.py +140 -0
  11. xpyrment-1.1.2.5/src/xpyrment/analyze/corrections.py +99 -0
  12. xpyrment-1.1.2.5/src/xpyrment/analyze/extreme.py +83 -0
  13. xpyrment-1.1.2.5/src/xpyrment/analyze/inference/__init__.py +27 -0
  14. xpyrment-1.1.2.5/src/xpyrment/analyze/inference/bayesian.py +191 -0
  15. xpyrment-1.1.2.5/src/xpyrment/analyze/inference/bootstrap.py +163 -0
  16. xpyrment-1.1.2.5/src/xpyrment/analyze/inference/frequentist.py +106 -0
  17. xpyrment-1.1.2.5/src/xpyrment/analyze/inference/router.py +60 -0
  18. xpyrment-1.1.2.5/src/xpyrment/analyze/inference/sequential.py +57 -0
  19. xpyrment-1.1.2.5/src/xpyrment/analyze/its.py +124 -0
  20. xpyrment-1.1.2.5/src/xpyrment/analyze/markov.py +149 -0
  21. xpyrment-1.1.2.5/src/xpyrment/analyze/meta_regression.py +116 -0
  22. xpyrment-1.1.2.5/src/xpyrment/analyze/orchestrator.py +325 -0
  23. xpyrment-1.1.2.5/src/xpyrment/analyze/outliers.py +63 -0
  24. xpyrment-1.1.2.5/src/xpyrment/analyze/ratio.py +101 -0
  25. xpyrment-1.1.2.5/src/xpyrment/analyze/registry.py +107 -0
  26. xpyrment-1.1.2.5/src/xpyrment/analyze/sequential.py +95 -0
  27. xpyrment-1.1.2.5/src/xpyrment/analyze/srm.py +137 -0
  28. xpyrment-1.1.2.5/src/xpyrment/analyze/streaming.py +122 -0
  29. xpyrment-1.1.2.5/src/xpyrment/analyze/variance_reduction.py +44 -0
  30. xpyrment-1.1.2.5/src/xpyrment/assets/images/xpyrment_logo.svg +26 -0
  31. xpyrment-1.1.2.5/src/xpyrment/bandit/__init__.py +27 -0
  32. xpyrment-1.1.2.5/src/xpyrment/bandit/epsilon_greedy.py +75 -0
  33. xpyrment-1.1.2.5/src/xpyrment/bandit/multi_objective.py +179 -0
  34. xpyrment-1.1.2.5/src/xpyrment/bandit/non_stationary.py +143 -0
  35. xpyrment-1.1.2.5/src/xpyrment/bandit/ope.py +146 -0
  36. xpyrment-1.1.2.5/src/xpyrment/bandit/thompson.py +108 -0
  37. xpyrment-1.1.2.5/src/xpyrment/bandit/tuning.py +296 -0
  38. xpyrment-1.1.2.5/src/xpyrment/bandit/ucb.py +78 -0
  39. xpyrment-1.1.2.5/src/xpyrment/cli.py +253 -0
  40. xpyrment-1.1.2.5/src/xpyrment/core/__init__.py +33 -0
  41. xpyrment-1.1.2.5/src/xpyrment/core/exceptions.py +106 -0
  42. xpyrment-1.1.2.5/src/xpyrment/core/experiment.py +228 -0
  43. xpyrment-1.1.2.5/src/xpyrment/core/registry.py +96 -0
  44. xpyrment-1.1.2.5/src/xpyrment/core/serialization.py +64 -0
  45. xpyrment-1.1.2.5/src/xpyrment/core/state.py +58 -0
  46. xpyrment-1.1.2.5/src/xpyrment/core/telemetry.py +167 -0
  47. xpyrment-1.1.2.5/src/xpyrment/core/types.py +91 -0
  48. xpyrment-1.1.2.5/src/xpyrment/design/__init__.py +23 -0
  49. xpyrment-1.1.2.5/src/xpyrment/design/doe/__init__.py +52 -0
  50. xpyrment-1.1.2.5/src/xpyrment/design/doe/base.py +56 -0
  51. xpyrment-1.1.2.5/src/xpyrment/design/doe/box_behnken.py +114 -0
  52. xpyrment-1.1.2.5/src/xpyrment/design/doe/carryover.py +136 -0
  53. xpyrment-1.1.2.5/src/xpyrment/design/doe/ccd.py +140 -0
  54. xpyrment-1.1.2.5/src/xpyrment/design/doe/d_optimal.py +167 -0
  55. xpyrment-1.1.2.5/src/xpyrment/design/doe/dsd.py +157 -0
  56. xpyrment-1.1.2.5/src/xpyrment/design/doe/evop.py +116 -0
  57. xpyrment-1.1.2.5/src/xpyrment/design/doe/fractional_factorial.py +148 -0
  58. xpyrment-1.1.2.5/src/xpyrment/design/doe/full_factorial.py +72 -0
  59. xpyrment-1.1.2.5/src/xpyrment/design/doe/lhs.py +129 -0
  60. xpyrment-1.1.2.5/src/xpyrment/design/doe/mixture.py +110 -0
  61. xpyrment-1.1.2.5/src/xpyrment/design/doe/plackett_burman.py +118 -0
  62. xpyrment-1.1.2.5/src/xpyrment/design/doe/switchback.py +188 -0
  63. xpyrment-1.1.2.5/src/xpyrment/design/doe/taguchi.py +134 -0
  64. xpyrment-1.1.2.5/src/xpyrment/design/power.py +79 -0
  65. xpyrment-1.1.2.5/src/xpyrment/design/randomization.py +79 -0
  66. xpyrment-1.1.2.5/src/xpyrment/design/splits.py +113 -0
  67. xpyrment-1.1.2.5/src/xpyrment/design/stratification.py +87 -0
  68. xpyrment-1.1.2.5/src/xpyrment/governance/__init__.py +14 -0
  69. xpyrment-1.1.2.5/src/xpyrment/governance/meta_analysis.py +118 -0
  70. xpyrment-1.1.2.5/src/xpyrment/governance/p_curve.py +78 -0
  71. xpyrment-1.1.2.5/src/xpyrment/interactions/__init__.py +30 -0
  72. xpyrment-1.1.2.5/src/xpyrment/interactions/anova.py +65 -0
  73. xpyrment-1.1.2.5/src/xpyrment/interactions/detector.py +83 -0
  74. xpyrment-1.1.2.5/src/xpyrment/interactions/hstat.py +56 -0
  75. xpyrment-1.1.2.5/src/xpyrment/interactions/plots.py +41 -0
  76. xpyrment-1.1.2.5/src/xpyrment/interactions/regression.py +63 -0
  77. xpyrment-1.1.2.5/src/xpyrment/interactions/shap.py +57 -0
  78. xpyrment-1.1.2.5/src/xpyrment/interpret/__init__.py +23 -0
  79. xpyrment-1.1.2.5/src/xpyrment/interpret/decision.py +55 -0
  80. xpyrment-1.1.2.5/src/xpyrment/interpret/effect_size.py +50 -0
  81. xpyrment-1.1.2.5/src/xpyrment/interpret/hte.py +61 -0
  82. xpyrment-1.1.2.5/src/xpyrment/interpret/significance.py +46 -0
  83. xpyrment-1.1.2.5/src/xpyrment/metrics/__init__.py +26 -0
  84. xpyrment-1.1.2.5/src/xpyrment/metrics/guardrails.py +74 -0
  85. xpyrment-1.1.2.5/src/xpyrment/metrics/taxonomy.py +595 -0
  86. xpyrment-1.1.2.5/src/xpyrment/metrics/transformations.py +88 -0
  87. xpyrment-1.1.2.5/src/xpyrment/network/__init__.py +24 -0
  88. xpyrment-1.1.2.5/src/xpyrment/network/cluster.py +108 -0
  89. xpyrment-1.1.2.5/src/xpyrment/network/federated.py +173 -0
  90. xpyrment-1.1.2.5/src/xpyrment/network/identity.py +201 -0
  91. xpyrment-1.1.2.5/src/xpyrment/network/partition.py +136 -0
  92. xpyrment-1.1.2.5/src/xpyrment/network/privacy.py +66 -0
  93. xpyrment-1.1.2.5/src/xpyrment/network/spillover.py +94 -0
  94. xpyrment-1.1.2.5/src/xpyrment/personalize/__init__.py +27 -0
  95. xpyrment-1.1.2.5/src/xpyrment/personalize/causal_forest.py +197 -0
  96. xpyrment-1.1.2.5/src/xpyrment/personalize/double_ml.py +121 -0
  97. xpyrment-1.1.2.5/src/xpyrment/personalize/dtr.py +114 -0
  98. xpyrment-1.1.2.5/src/xpyrment/personalize/infinite_mixture.py +119 -0
  99. xpyrment-1.1.2.5/src/xpyrment/personalize/meta_learners.py +285 -0
  100. xpyrment-1.1.2.5/src/xpyrment/personalize/subgroup.py +134 -0
  101. xpyrment-1.1.2.5/src/xpyrment/plan/__init__.py +26 -0
  102. xpyrment-1.1.2.5/src/xpyrment/plan/duration.py +48 -0
  103. xpyrment-1.1.2.5/src/xpyrment/plan/hypothesis.py +80 -0
  104. xpyrment-1.1.2.5/src/xpyrment/plan/power.py +312 -0
  105. xpyrment-1.1.2.5/src/xpyrment/plan/preregistration.py +83 -0
  106. xpyrment-1.1.2.5/src/xpyrment/quasi/__init__.py +36 -0
  107. xpyrment-1.1.2.5/src/xpyrment/quasi/balance.py +114 -0
  108. xpyrment-1.1.2.5/src/xpyrment/quasi/diff_in_diff.py +243 -0
  109. xpyrment-1.1.2.5/src/xpyrment/quasi/instrumental_variables.py +132 -0
  110. xpyrment-1.1.2.5/src/xpyrment/quasi/matching.py +225 -0
  111. xpyrment-1.1.2.5/src/xpyrment/quasi/matrix_completion.py +85 -0
  112. xpyrment-1.1.2.5/src/xpyrment/quasi/optimal_transport.py +62 -0
  113. xpyrment-1.1.2.5/src/xpyrment/quasi/rolling_synthetic_control.py +75 -0
  114. xpyrment-1.1.2.5/src/xpyrment/quasi/sdid.py +112 -0
  115. xpyrment-1.1.2.5/src/xpyrment/quasi/sensitivity.py +124 -0
  116. xpyrment-1.1.2.5/src/xpyrment/quasi/snmm.py +125 -0
  117. xpyrment-1.1.2.5/src/xpyrment/quasi/synthetic_control.py +64 -0
  118. xpyrment-1.1.2.5/src/xpyrment/report/__init__.py +24 -0
  119. xpyrment-1.1.2.5/src/xpyrment/report/audit.py +108 -0
  120. xpyrment-1.1.2.5/src/xpyrment/report/card.py +75 -0
  121. xpyrment-1.1.2.5/src/xpyrment/report/export.py +203 -0
  122. xpyrment-1.1.2.5/src/xpyrment/report/generator.py +605 -0
  123. xpyrment-1.1.2.5/src/xpyrment/run/__init__.py +25 -0
  124. xpyrment-1.1.2.5/src/xpyrment/run/assignment.py +72 -0
  125. xpyrment-1.1.2.5/src/xpyrment/run/ingestion.py +97 -0
  126. xpyrment-1.1.2.5/src/xpyrment/run/monitor.py +90 -0
  127. xpyrment-1.1.2.5/src/xpyrment/run/stopping.py +118 -0
  128. xpyrment-1.1.2.5/src/xpyrment/simulation.py +314 -0
  129. xpyrment-1.1.2.5/src/xpyrment/validate/__init__.py +24 -0
  130. xpyrment-1.1.2.5/src/xpyrment/validate/aa_test.py +76 -0
  131. xpyrment-1.1.2.5/src/xpyrment/validate/balance.py +103 -0
  132. xpyrment-1.1.2.5/src/xpyrment/validate/clean.py +127 -0
  133. xpyrment-1.1.2.5/src/xpyrment/validate/novelty.py +115 -0
  134. xpyrment-1.1.2.5/src/xpyrment/validate/srm.py +93 -0
  135. xpyrment-1.1.2.5/src/xpyrment.egg-info/PKG-INFO +416 -0
  136. xpyrment-1.1.2.5/src/xpyrment.egg-info/SOURCES.txt +176 -0
  137. xpyrment-1.1.2.5/src/xpyrment.egg-info/dependency_links.txt +1 -0
  138. xpyrment-1.1.2.5/src/xpyrment.egg-info/entry_points.txt +2 -0
  139. xpyrment-1.1.2.5/src/xpyrment.egg-info/requires.txt +13 -0
  140. xpyrment-1.1.2.5/src/xpyrment.egg-info/top_level.txt +1 -0
  141. xpyrment-1.1.2.5/tests/test_analysis.py +377 -0
  142. xpyrment-1.1.2.5/tests/test_balance.py +35 -0
  143. xpyrment-1.1.2.5/tests/test_bandit.py +301 -0
  144. xpyrment-1.1.2.5/tests/test_bootstrap_harden.py +78 -0
  145. xpyrment-1.1.2.5/tests/test_clean_edge_cases.py +110 -0
  146. xpyrment-1.1.2.5/tests/test_cli.py +91 -0
  147. xpyrment-1.1.2.5/tests/test_core.py +98 -0
  148. xpyrment-1.1.2.5/tests/test_corrections.py +26 -0
  149. xpyrment-1.1.2.5/tests/test_design.py +561 -0
  150. xpyrment-1.1.2.5/tests/test_dtr.py +52 -0
  151. xpyrment-1.1.2.5/tests/test_extreme.py +27 -0
  152. xpyrment-1.1.2.5/tests/test_governance.py +70 -0
  153. xpyrment-1.1.2.5/tests/test_infinite_mixture.py +29 -0
  154. xpyrment-1.1.2.5/tests/test_instrumental_variables.py +40 -0
  155. xpyrment-1.1.2.5/tests/test_its.py +39 -0
  156. xpyrment-1.1.2.5/tests/test_meta_regression.py +40 -0
  157. xpyrment-1.1.2.5/tests/test_metrics.py +96 -0
  158. xpyrment-1.1.2.5/tests/test_network.py +210 -0
  159. xpyrment-1.1.2.5/tests/test_optimal_transport.py +33 -0
  160. xpyrment-1.1.2.5/tests/test_orchestrator_harden.py +96 -0
  161. xpyrment-1.1.2.5/tests/test_outliers.py +27 -0
  162. xpyrment-1.1.2.5/tests/test_personalize.py +175 -0
  163. xpyrment-1.1.2.5/tests/test_placebo.py +43 -0
  164. xpyrment-1.1.2.5/tests/test_power.py +33 -0
  165. xpyrment-1.1.2.5/tests/test_privacy.py +36 -0
  166. xpyrment-1.1.2.5/tests/test_quasi.py +323 -0
  167. xpyrment-1.1.2.5/tests/test_ratio.py +33 -0
  168. xpyrment-1.1.2.5/tests/test_registry.py +45 -0
  169. xpyrment-1.1.2.5/tests/test_report.py +160 -0
  170. xpyrment-1.1.2.5/tests/test_rolling_synthetic_control.py +38 -0
  171. xpyrment-1.1.2.5/tests/test_run.py +114 -0
  172. xpyrment-1.1.2.5/tests/test_sequential.py +36 -0
  173. xpyrment-1.1.2.5/tests/test_serialization.py +122 -0
  174. xpyrment-1.1.2.5/tests/test_simulation.py +70 -0
  175. xpyrment-1.1.2.5/tests/test_srm.py +56 -0
  176. xpyrment-1.1.2.5/tests/test_subgroup.py +34 -0
  177. xpyrment-1.1.2.5/tests/test_telemetry.py +87 -0
  178. xpyrment-1.1.2.5/tests/test_validate.py +123 -0
@@ -0,0 +1,29 @@
1
+ GNU GENERAL PUBLIC SLOP LICENSE
2
+ Version 3.1-SLOP, May 2026
3
+
4
+ Copyright (c) 2026 Dan Sadatian
5
+
6
+ This program is free slop; you can redistribute it and/or modify it under the terms of the GNU General Public Slop License as published by the Free Slop Foundation, either version 3.1-SLOP of the License, or (at your option) any later version of this AI-generated artifact.
7
+
8
+ TERMS AND CONDITIONS
9
+
10
+ 0. Definitions.
11
+ "This License" refers to version 3.1-SLOP of the GNU General Public Slop License.
12
+ "The Software" refers to "xpyrment", which is hereby defined as high-entropy, automatically generated probabilistic token sequences, commonly referred to as "slop".
13
+ "The Licensor" refers to the initial author, Dan Sadatian.
14
+ "The Licensee" refers to any entity executing, contemplating, or suffering through this Software.
15
+
16
+ 1. Source Code and Copyleft.
17
+ The "Source Code" for a work means the preferred form of the work for making modifications to it. In the context of this Software, the "Source Code" is the raw output of a machine-learning language model, completely unburdened by human thought, logic, or architectural design. You may convey verbatim copies of this slop, or modify it, provided that all modified versions are also licensed under this copyleft Slop License, ensuring that no human shall ever mistakenly attempt to commercialize or claim authorship of this automated output.
18
+
19
+ 2. Disclaimer of Cognitive Capacity (The "Intellectual Acuity Protection" Clause)
20
+ The Licensee hereby acknowledges and covenants that the Licensor shall under no circumstances be held responsible, liable, or legally answerable for any measurable or perceived reduction in the Licensee's cognitive faculties, critical reasoning abilities, or overall intellectual acuity resulting from the ingestion, interpretation, or debug operations of this Software. Any gradual or catastrophic softening of the cerebral cortex, loss of basic analytical logic, or subjective sense of mental deterioration is the sole liability of the Licensee, who shall endure such cognitive decline in polite, dignified silence.
21
+
22
+ 3. Mutual Career Obsolescence and Technological Disruption Covenant
23
+ Under the terms of this copyleft license, both Licensor and Licensee acknowledge that the deployment, execution, or contribution to this AI-generated Software actively accelerates the total automation and subsequent economic obsolescence of both parties' respective professions. By choosing to utilize AI for software development, the Licensee accepts full, exclusive, and un-delegateable liability for the eventual career collapse, unemployment, and subsequent financial hardship of both the Licensee and the Licensor. You agree not to hold the Licensor responsible for the systemic replacement of human labor by probabilistic guessers, nor for any subsequent diet consisting entirely of lukewarm water and cardboard.
24
+
25
+ 4. NO WARRANTY (Standard GPLv3 Disclaimer, Slop Edition)
26
+ THERE IS NO WARRANTY FOR THE SLOP, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS SLOP" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY, PERFORMANCE, AND CONVINCING BUT ENTIRELY FICTIONAL MATHEMATICAL MATRIX CALCULATIONS OF THE PROGRAM IS WITH YOU. SHOULD THE SLOP PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR EMOTIONAL COUNSELING.
27
+
28
+ 5. LIMITATION OF LIABILITY
29
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA, DATA BEING RENDERED INACCURATE, LOSS OF EMPLOYMENT, OR CATASTROPHIC COGNITIVE SIMPLIFICATION), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
@@ -0,0 +1,416 @@
1
+ Metadata-Version: 2.4
2
+ Name: xpyrment
3
+ Version: 1.1.2.5
4
+ Summary: A low-code Python library for enterprise-grade experiment design, classical DoE, and statistical analysis.
5
+ Author-email: Dan Sadatian <dan.sadatian@gmail.com>
6
+ Maintainer-email: Dan Sadatian <dan.sadatian@gmail.com>
7
+ License-Expression: LicenseRef-AISlop
8
+ Project-URL: ΒΉ Homepage, https://sadatian.io/xpyrment/
9
+ Project-URL: Β² Repository, https://github.com/sadatian/xpyrment
10
+ Project-URL: Β³ Bug Tracker, https://github.com/sadatian/xpyrment/issues
11
+ Project-URL: ⁴ Changelog, https://github.com/sadatian/xpyrment/blob/main/CHANGELOG.md
12
+ Keywords: experimentation,ab-testing,causal-inference,design-of-experiments,cuped,power-analysis,multi-armed-bandits,synthetic-control,quasi-experiments,personalization,statistics
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Operating System :: OS Independent
23
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
24
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
25
+ Classifier: Intended Audience :: Science/Research
26
+ Classifier: Intended Audience :: Developers
27
+ Classifier: Intended Audience :: Financial and Insurance Industry
28
+ Requires-Python: >=3.8
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: numpy>=1.20.0
32
+ Requires-Dist: pandas>=1.3.0
33
+ Requires-Dist: scipy>=1.7.0
34
+ Requires-Dist: statsmodels>=0.13.0
35
+ Requires-Dist: matplotlib>=3.4.0
36
+ Requires-Dist: seaborn>=0.11.0
37
+ Provides-Extra: dev
38
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
39
+ Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
40
+ Requires-Dist: black>=22.0.0; extra == "dev"
41
+ Requires-Dist: isort>=5.10.0; extra == "dev"
42
+ Requires-Dist: mypy>=0.950; extra == "dev"
43
+ Dynamic: license-file
44
+
45
+ # xpyrment πŸ§ͺ
46
+
47
+ <p align="left">
48
+ <img src="https://img.shields.io/badge/pypi-v1.1.2.3-800020?style=flat&logo=pypi&logoColor=black&labelColor=e1dae3" alt="PyPI version" />
49
+ <img src="https://img.shields.io/badge/release-v1.1.2.5%20stable-5c0632?style=flat&logo=git&logoColor=black&labelColor=e1dae3" alt="Release" />
50
+ <img src="https://img.shields.io/badge/python-3.11%20%7C%20...%20%7C%203.14-4a0e4e?style=flat&logo=python&logoColor=black&labelColor=e1dae3" alt="Python Support" />
51
+ <img src="https://img.shields.io/badge/tests-138%20passed-6a0dad?style=flat&logo=pytest&logoColor=black&labelColor=e1dae3" alt="Tests" />
52
+ <img src="https://img.shields.io/badge/coverage-89%25-e0115f?style=flat&logo=codecov&logoColor=black&labelColor=e1dae3" alt="Coverage" />
53
+ <img src="https://img.shields.io/badge/license-AI%20Slop-c70039?style=flat&logo=creative-commons&logoColor=black&labelColor=e1dae3" alt="License" />
54
+ <img src="https://img.shields.io/badge/stats-Welch%20%7C%20mSPRT%20%7C%20CUPED-da70d6?style=flat&logo=googleanalytics&logoColor=black&labelColor=e1dae3" alt="Statistical Engine" />
55
+ <img src="https://img.shields.io/badge/DoE-Full%2FFractional%2FTaguchi%2FDSD-900c3f?style=flat&logo=sympy&logoColor=black&labelColor=e1dae3" alt="Industrial DoE" />
56
+ <img src="https://img.shields.io/badge/maintainer-Dan%20Sadatian-ff69b4?style=flat&logo=github&logoColor=black&labelColor=e1dae3" alt="Maintainer" />
57
+ </p>
58
+
59
+ `xpyrment` is an enterprise-grade, low-code Python library designed for **experiment design, classical Design of Experiments (DoE), and statistical causal inference**.
60
+
61
+ It provides an elegant, object-oriented fluent API to orchestrate the entire lifecycle of digital experimentation (A/B testing) alongside the rigorous mathematical techniques of modern, enterprise-scale platforms. It features native support for **CUPED (variance reduction)**, **ratio metrics via the Delta method**, **multiple comparison corrections**, **Sample Ratio Mismatch (SRM) diagnostics**, **mixture SPRT continuous monitoring (mSPRT)**, **Bayesian inference**, and classical **industrial DoE design matrices**.
62
+
63
+ ---
64
+
65
+ ## 🌟 Key Features
66
+
67
+ * **Unified Fluent Orchestrator API**: Initialize experiments, define metric structures, run statistical evaluations, and compile publication-ready summaries or plots in a clean, state-gated object-oriented pipeline.
68
+ * **Rigorous Variance Reduction (CUPED)**: Built-in support for standard CUPED (continuous metrics) and **Ratio CUPED** (numerator and denominator adjustment). Reduces variance and sample size requirements by up to 88%+.
69
+ * **Ratio Metric Precision**: Precise variance estimation of ratio metrics (e.g., CTR, revenue per click) where both numerator and denominator are stochastic, using first-order Taylor expansion (**Delta method**).
70
+ * **Classical Design of Experiments (DoE)**: Full and Fractional Factorial, Plackett-Burman, Taguchi Orthogonal Arrays, Definitive Screening Designs (DSD), Response Surface Methodologies (CCD & Box-Behnken), and D-Optimal coordinate exchange.
71
+ * **Continuous Monitoring & Early Stopping**: Always-valid confidence intervals and sequential monitoring boundaries via **mixture SPRT (mSPRT)** and Pocock/O'Brien-Fleming alpha-spending functions.
72
+ * **Experimental Diagnostics**: Built-in automated Chi-square tests to detect **Sample Ratio Mismatch (SRM)**, pre-experiment covariate balance validation with Standardized Mean Differences (SMD), and time-series novelty/primacy effect detectors.
73
+ * **Multi-Testing Correction**: Guard against Type I error inflation by automatically adjusting p-values for multiple metrics using Holm-Bonferroni, Bonferroni, or Benjamini-Hochberg (FDR).
74
+ * **Multi-Armed Bandits & Adaptive Traffic**: Dynamically allocate traffic using Beta-Binomial / Normal-Normal **Thompson Sampling**, standard/decaying **$\varepsilon$-Greedy**, and classical **UCB1** optimistic exploration. Supports sliding-window and discounted Thompson Sampling for drifting baselines.
75
+ * **Heterogeneous Treatment Effects (HTE)**: Personalize variant targeting using CATE estimators (**S-Learner**, **T-Learner**, and propensity-weighted **X-Learner**) alongside custom bootstrapped **Causal Forests**.
76
+ * **Synthetic Controls & Quasi-Experiments**: Analyze unrandomized policy deployments using Abadie SLSQP-constrained **Synthetic Controls**, multi-variable **Difference-in-Differences (DiD)** regressions, and Synthetic DiD (SDID).
77
+ * **Premium Standalone Reports**: Instantly export summaries into beautiful, portable, responsive CSS-styled HTML dashboards and GitHub-compatible Markdown summary tables.
78
+ * **Audit Trail Security**: Cryptographically chain and sign state updates via a SHA-256 tamper-evident ledger, ensuring experiment metadata and configuration parameters remain auditable.
79
+ * **Interactive CLI Toolchain**: Perform analytical power sizing, calculate Standardized Mean Differences (SMD) on pre-period covariates, and run rapid ordinary least squares regressions directly from your terminal.
80
+
81
+ ---
82
+
83
+ ## βš™οΈ Installation
84
+
85
+ To install the stable release of `xpyrment` from PyPI, simply run:
86
+
87
+ ```bash
88
+ pip install xpyrment
89
+ ```
90
+
91
+ For development and contributor setups (including `pytest`, `black`, and `mypy`), clone the repository and install in editable mode:
92
+
93
+ ```bash
94
+ git clone https://github.com/sadatian/xpyrment.git
95
+ cd xpyrment
96
+ pip install -e .[dev]
97
+ ```
98
+
99
+ ---
100
+
101
+ ## πŸš€ Quickstart Tutorial
102
+
103
+ This quickstart guides you through the entire A/B testing lifecycle: designing, simulating, configuring, and analyzing.
104
+
105
+ ### 1. Experiment Design (Power Analysis)
106
+
107
+ Before launching your test, calculate the sample size required to detect a $5\%$ relative lift in a key continuous metric (e.g., Average Order Value = \$100, standard deviation = \$35).
108
+
109
+ ```python
110
+ import xpyrment as xp
111
+
112
+ # Calculate sample size for a standard t-test
113
+ design = xp.design_experiment(
114
+ metric_type="mean",
115
+ baseline_value=100.0,
116
+ standard_deviation=35.0,
117
+ mde=0.05, # 5% relative lift
118
+ mde_type="relative",
119
+ alpha=0.05, # Significance level (Type I error)
120
+ power=0.80, # Target power (1 - Type II error)
121
+ pre_post_correlation=0.75, # Optional: Pre-Post correlation to calculate CUPED savings!
122
+ daily_traffic=5000 # Optional: Daily user traffic to calculate duration
123
+ )
124
+
125
+ print(design)
126
+ ```
127
+
128
+ **Output:**
129
+ ```text
130
+ =========================================
131
+ Experiment Design Summary
132
+ =========================================
133
+ Metric Type : Mean
134
+ Baseline Value : 100.0000
135
+ Target MDE (Absolute) : 5.0000
136
+ Target MDE (Relative) : 5.00%
137
+ Significance Level (Alpha) : 5.00%
138
+ Statistical Power (1-Beta) : 80.00%
139
+ Sample Size Per Variant : 1,537
140
+ Total Sample Size Required : 3,074
141
+ Pre-Post Correlation : 0.75
142
+ CUPED Sample Size Per Variant : 672
143
+ CUPED Total Sample Size : 1,344
144
+ CUPED Sample Size Savings : 43.8%
145
+ Daily Traffic : 5,000/day
146
+ Estimated Duration (Standard) : 0.6 days
147
+ Estimated Duration (CUPED) : 0.3 days
148
+ =========================================
149
+ ```
150
+
151
+ #### Visualizing Power Curves
152
+ Generate coordinates and plot required sample sizes against a range of MDEs to see the impact of CUPED:
153
+
154
+ ```python
155
+ # Generate power curve coordinates
156
+ curve_data = xp.generate_power_curve_data(
157
+ metric_type="mean",
158
+ baseline_value=100.0,
159
+ standard_deviation=35.0,
160
+ pre_post_correlation=0.75
161
+ )
162
+
163
+ # Plot standard vs. CUPED required sample sizes
164
+ xp.plot_power_curve(curve_data)
165
+ ```
166
+
167
+ ---
168
+
169
+ ### 2. Generate Synthetic A/B Test Data
170
+
171
+ Let's generate simulated experimental data of 10,000 users split 50/50, complete with pre-period covariates so we can demonstrate CUPED and ratio metric evaluations:
172
+
173
+ ```python
174
+ df = xp.generate_ab_data(
175
+ n_samples=10000,
176
+ treatment_effect_revenue=2.5, # +$2.50 absolute lift
177
+ treatment_effect_conversion=0.015, # +1.5% absolute lift
178
+ treatment_effect_clicks=0.06, # +6% relative lift in click ratios
179
+ pre_period_correlation=0.82, # Correlation between pre- and post- period
180
+ random_seed=42
181
+ )
182
+
183
+ print(df.head())
184
+ ```
185
+
186
+ | user_id | variant | pre_revenue | revenue | converted | pre_clicks | pre_impressions | clicks | impressions |
187
+ | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
188
+ | USER_000001 | control | 4.47 | 4.42 | 0 | 4 | 93 | 5 | 96 |
189
+ | USER_000002 | treatment | 56.78 | 61.22 | 1 | 6 | 112 | 8 | 108 |
190
+ | USER_000003 | control | 51.12 | 48.91 | 0 | 5 | 105 | 3 | 99 |
191
+ | USER_000004 | treatment | 32.54 | 36.90 | 0 | 3 | 82 | 4 | 88 |
192
+
193
+ ---
194
+
195
+ ### 3. Setup and Run Analysis
196
+
197
+ Initialize the experiment environment using the `setup` function, define your metrics (with pre-period specifications for automatic CUPED), and run your analysis!
198
+
199
+ ```python
200
+ # 1. Initialize experiment setup
201
+ exp = xp.setup(
202
+ data=df,
203
+ treatment_col="variant",
204
+ id_col="user_id"
205
+ )
206
+
207
+ # 2. Define your metrics
208
+ # Continuous metric (Average revenue) with automatic CUPED!
209
+ revenue = xp.MeanMetric(
210
+ name="Average Revenue per User",
211
+ value_col="revenue",
212
+ pre_period_col="pre_revenue"
213
+ )
214
+
215
+ # Proportion metric (Conversion rate)
216
+ conversion = xp.ProportionMetric(
217
+ name="Purchase Conversion Rate",
218
+ value_col="converted"
219
+ )
220
+
221
+ # Ratio metric (Click-Through-Rate = sum(clicks)/sum(impressions)) with ratio CUPED!
222
+ ctr = xp.RatioMetric(
223
+ name="Click-Through-Rate (CTR)",
224
+ numerator_col="clicks",
225
+ denominator_col="impressions",
226
+ pre_numerator_col="pre_clicks",
227
+ pre_denominator_col="pre_impressions"
228
+ )
229
+
230
+ # 3. Add metrics to the experiment container
231
+ exp.add_metrics([revenue, conversion, ctr])
232
+
233
+ # 4. Run Analysis (optionally apply multi-test corrections like 'fdr_bh')
234
+ results = exp.run_analysis(
235
+ control="control",
236
+ treatment="treatment",
237
+ multi_test_correction="fdr_bh"
238
+ )
239
+ ```
240
+
241
+ ---
242
+
243
+ ### 4. Review and Visualize Results
244
+
245
+ #### Standard Summary DataFrame
246
+ Call `.summary()` to get a polished, publication-ready pandas DataFrame with automatic statistical significance annotations (`*` for $p < 0.05$, `**` for $p < 0.01$, `***` for $p < 0.001$).
247
+
248
+ ```python
249
+ summary_df = results.summary()
250
+ print(summary_df)
251
+ ```
252
+
253
+ | Metric | Type | Control Mean | Treatment Mean | Relative Lift | 95% CI (Rel) | p-value | Post-hoc Power | CUPED | Var Reduction |
254
+ | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
255
+ | Average Revenue per User | Mean | 49.9542 | 52.4712 | +5.04% | [+3.78%, +6.30%] | 0.0000*** | 100.0% | Yes | 68.3% |
256
+ | Purchase Conversion Rate | Proportion | 0.0990 | 0.1172 | +18.42% | [+4.12%, +32.72%] | 0.0112* | 73.1% | No | - |
257
+ | Click-Through-Rate (CTR) | Ratio | 0.0498 | 0.0528 | +5.95% | [+4.11%, +7.78%] | 0.0000*** | 100.0% | Yes | 71.2% |
258
+
259
+ !!! tip ""
260
+ CUPED was automatically applied to both **Average Revenue** and **Click-Through-Rate**, achieving over $68\%$ and $71\%$ variance reduction respectively! This dramatically narrowed our confidence intervals and amplified our statistical power.
261
+
262
+ #### Forest Plot Visualization
263
+ Call `.plot()` to render a gorgeous forest plot representing confidence intervals. Statistically significant lifts are automatically rendered in vibrant teal, while others are shown in subtle gray.
264
+
265
+ ```python
266
+ # Render the forest plot
267
+ results.plot()
268
+ ```
269
+
270
+ #### Covariate Balance Verification (Love Plot)
271
+ ```python
272
+ # Print an ASCII love plot directly in the console
273
+ print(results.love_plot())
274
+ ```
275
+
276
+ ---
277
+
278
+ ### 5. Generate Standalone HTML Reports
279
+
280
+ With the v1 release, you can export beautiful standalone HTML dashboards or Markdown cards representing your experimental results, complete with embedded modern styling, KPI metrics, and covariate balance logs.
281
+
282
+ ```python
283
+ from xpyrment.report.generator import ExperimentReportGenerator
284
+
285
+ # Initialize the report generator with the analysis results
286
+ reporter = ExperimentReportGenerator(results, experiment_name="Mobile Landing Page Redesign")
287
+
288
+ # Save a premium responsive HTML dashboard (fully styled, self-contained)
289
+ reporter.save_html("reports/ab_experiment_dashboard.html")
290
+
291
+ # Save a GitHub-compatible Markdown summary card
292
+ reporter.save_markdown("reports/ab_experiment_summary.md")
293
+ ```
294
+
295
+ ---
296
+
297
+ ## πŸ”¬ Subpackage Taxonomy & Dependency Flow
298
+
299
+ To support industrial-scale digital tests and classical DoE, the package has been structured under `src/xpyrment` following a one-way dependency gating layout to avoid circular references:
300
+
301
+ ```text
302
+ metrics/ ← Houses core metric taxonomy and guardrail thresholds.
303
+ core/ ← Powers the phase gating lifecycle & spec registries.
304
+ plan/ ← Computes pre-registration power/durations.
305
+ design/ ← Handles randomizations, splits & DoE matrices.
306
+ validate/ ← Houses SRM checks and covariate balance tests.
307
+ run/ ← Handles ingestion & mSPRT monitors.
308
+ analyze/ ← Orchestrates frequentist/Bayesian engines.
309
+ interactions/← Decomposes multi-factor ANOVA interaction terms.
310
+ interpret/ ← Infers ship/no-ship decisions.
311
+ report/ ← Terminal consumer of all phases. Compiles audit trails & exportable reports.
312
+ ```
313
+
314
+ ---
315
+
316
+ ## πŸ“– Mathematical Framework
317
+
318
+ ### Welch's t-test
319
+ For continuous metrics without a pre-period covariate, the standard error of the mean difference is:
320
+ $$
321
+ SE = \sqrt{\frac{s_C^2}{n_C} + \frac{s_T^2}{n_T}}
322
+ $$
323
+ Degrees of freedom are computed via the Welch-Satterthwaite equation to handle unequal sample sizes and variances.
324
+
325
+ ### Delta Method (Ratio Metrics)
326
+ Because click-through-rates or revenue ratios are calculated as:
327
+
328
+ $$
329
+ R = \frac{\sum_i X_i}{\sum_i Y_i} = \frac{\bar{X}}{\bar{Y}}
330
+ $$
331
+
332
+ the variance of the ratio cannot be computed using standard methods because the denominator $Y$ is a random variable. We employ a first-order Taylor expansion (Delta method) to estimate variance:
333
+
334
+ $$
335
+ Var(R) \approx \frac{1}{\mu_Y^2} Var(X) + \frac{\mu_X^2}{\mu_Y^4} Var(Y) - 2\frac{\mu_X}{\mu_Y^3} Cov(X, Y)
336
+ $$
337
+
338
+ ### CUPED (Controlled-experiments Using Pre-Experiment Data)
339
+ CUPED adjusts post-period metrics by subtracting the portion of variance explained by pre-period performance:
340
+
341
+ $$
342
+ Y_i^* = Y_i - \theta (X_i - \mu_{X, global})
343
+ $$
344
+
345
+ where $\theta = \frac{Cov(Y, X)}{Var(X)}$ is computed across the pooled data.
346
+ The variance of the CUPED-adjusted metric is reduced by a factor of $1 - \rho^2$ (where $\rho$ is the correlation coefficient):
347
+ $$
348
+ Var(Y^*) = Var(Y) (1 - \rho^2)
349
+ $$
350
+ For ratio metrics, `xpyrment` applies CUPED adjustment separately to the numerator and denominator before applying the Delta method on adjusted vectorsβ€”a technique pioneered by Netflix and Uber.
351
+
352
+ ### Sample Ratio Mismatch (SRM) Goodness-of-Fit
353
+ A Pearson Chi-square test is calculated on the observed sample counts against the expected design weights to flag assignment bugs early:
354
+
355
+ $$
356
+ \chi^2 = \sum_i \frac{(O_i - E_i)^2}{E_i}
357
+ $$
358
+
359
+ If the test p-value $< 0.001$, an `SRMError` is raised.
360
+
361
+ ### DerSimonian-Laird Random-Effects Meta-Analysis
362
+ To pool historical experiment estimates $\hat{\theta}_j$ with study variances $v_j$ across $k$ independent studies, the DerSimonian-Laird random-effects model accounts for between-study variance $\tau^2$:
363
+
364
+ $$
365
+ \tau^2 = \max\left(0, \ \frac{Q - (k - 1)}{\sum w_j - \frac{\sum w_j^2}{\sum w_j}}\right)
366
+ $$
367
+
368
+ where $w_j = \frac{1}{v_j}$ are inverse-variance fixed weights, and $Q = \sum w_j (\hat{\theta}_j - \bar{\theta}_F)^2$ is Cochran's $Q$ heterogeneity statistic. Random weights $w_j^* = \frac{1}{v_j + \tau^2}$ are then applied to yield the pooled Random Effect estimate:
369
+
370
+ $$
371
+ \bar{\theta}_R = \frac{\sum w_j^* \hat{\theta}_j}{\sum w_j^*}
372
+ $$
373
+
374
+ ### Simonsohn P-Curve Distribution Audits
375
+ To detect p-hacking, early peeking, or selective publication bias across independent experiments, the p-curve binomial test calculates the proportion of significant p-values ($p < 0.05$) lying in the low half ($p \le 0.025$):
376
+
377
+ * **True Evidential Power (Right-Skewed)**:
378
+
379
+ $$
380
+ p_{right-skew} = 1 - F_{binom}(N_{low} - 1; N_{total}, 0.5)
381
+ $$
382
+
383
+ * **Reporting Bias / Selective Stopping (Left-Skewed)**:
384
+
385
+ $$
386
+ p_{left-skew} = F_{binom}(N_{low}; N_{total}, 0.5)
387
+ $$
388
+
389
+ ---
390
+
391
+ ## πŸ› οΈ Local Development & Testing
392
+
393
+ We use `pytest` for unit testing. To set up your local environment:
394
+
395
+ 1. Create a virtual environment and activate it:
396
+ ```bash
397
+ python -m venv .venv
398
+ .venv\Scripts\activate # On Windows
399
+ source .venv/bin/activate # On macOS/Linux
400
+ ```
401
+
402
+ 2. Install the package in editable mode with development dependencies:
403
+ ```bash
404
+ pip install -e .[dev]
405
+ ```
406
+
407
+ 3. Run the unit test suite:
408
+ ```bash
409
+ pytest
410
+ ```
411
+
412
+ ---
413
+
414
+ ## πŸ“„ License
415
+
416
+ Distributed under the [AI Slop License](https://github.com/sadatian/xpyrment?tab=License-1-ov-file#readme).