mcab 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.
- mcab-0.1.0/LICENSE +21 -0
- mcab-0.1.0/PKG-INFO +49 -0
- mcab-0.1.0/README.md +2 -0
- mcab-0.1.0/pyproject.toml +99 -0
- mcab-0.1.0/setup.cfg +4 -0
- mcab-0.1.0/src/mcab/__init__.py +149 -0
- mcab-0.1.0/src/mcab/core.py +2740 -0
- mcab-0.1.0/src/mcab/effects.py +518 -0
- mcab-0.1.0/src/mcab/mstats.py +1644 -0
- mcab-0.1.0/src/mcab/plots.py +1222 -0
- mcab-0.1.0/src/mcab/tests.py +594 -0
- mcab-0.1.0/src/mcab/transform.py +666 -0
- mcab-0.1.0/src/mcab/utils.py +54 -0
- mcab-0.1.0/src/mcab.egg-info/PKG-INFO +49 -0
- mcab-0.1.0/src/mcab.egg-info/SOURCES.txt +16 -0
- mcab-0.1.0/src/mcab.egg-info/dependency_links.txt +1 -0
- mcab-0.1.0/src/mcab.egg-info/requires.txt +21 -0
- mcab-0.1.0/src/mcab.egg-info/top_level.txt +1 -0
mcab-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sergey Lastochkin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
mcab-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcab
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Monte Carlo A/B Testing Library - comprehensive tools for A/B test design and analysis
|
|
5
|
+
Author: Sergey Lastochkin
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sslastochkin/mcab
|
|
8
|
+
Project-URL: Documentation, https://sslastochkin.github.io/mcab/
|
|
9
|
+
Project-URL: Repository, https://github.com/sslastochkin/mcab
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/sslastochkin/mcab/issues
|
|
11
|
+
Keywords: ab-testing,monte-carlo,statistics,hypothesis-testing,experimentation,data-science,bootstrap,permutation-test,multiple-testing,experiments
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: numpy>=1.20.0
|
|
28
|
+
Requires-Dist: pandas>=1.3.0
|
|
29
|
+
Requires-Dist: scipy>=1.7.0
|
|
30
|
+
Requires-Dist: matplotlib>=3.4.0
|
|
31
|
+
Requires-Dist: seaborn>=0.11.0
|
|
32
|
+
Requires-Dist: joblib>=1.0.0
|
|
33
|
+
Requires-Dist: tqdm>=4.60.0
|
|
34
|
+
Requires-Dist: threadpoolctl>=3.0.0
|
|
35
|
+
Provides-Extra: dev
|
|
36
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: black>=22.0.0; extra == "dev"
|
|
39
|
+
Requires-Dist: flake8>=4.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: mypy>=0.950; extra == "dev"
|
|
41
|
+
Requires-Dist: isort>=5.10.0; extra == "dev"
|
|
42
|
+
Provides-Extra: docs
|
|
43
|
+
Requires-Dist: sphinx>=4.5.0; extra == "docs"
|
|
44
|
+
Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
|
|
45
|
+
Requires-Dist: numpydoc>=1.2.0; extra == "docs"
|
|
46
|
+
Dynamic: license-file
|
|
47
|
+
|
|
48
|
+
# MCAB: Monte Carlo Simulations for A/B Testing
|
|
49
|
+
A Python toolkit to design and validate A/B experiments via simulation: estimate power, find MDE, and control type-I error. Supports iid & ratio metrics, linearization, CUPED/CUPAC variance reduction, bootstrap/permutation tests, multiple-testing corrections, and AA/AB benchmarking.
|
mcab-0.1.0/README.md
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
# MCAB: Monte Carlo Simulations for A/B Testing
|
|
2
|
+
A Python toolkit to design and validate A/B experiments via simulation: estimate power, find MDE, and control type-I error. Supports iid & ratio metrics, linearization, CUPED/CUPAC variance reduction, bootstrap/permutation tests, multiple-testing corrections, and AA/AB benchmarking.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "mcab"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Monte Carlo A/B Testing Library - comprehensive tools for A/B test design and analysis"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{name = "Sergey Lastochkin"}
|
|
12
|
+
]
|
|
13
|
+
license = {text = "MIT"}
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Science/Research",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.8",
|
|
21
|
+
"Programming Language :: Python :: 3.9",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Topic :: Scientific/Engineering :: Mathematics",
|
|
26
|
+
"Topic :: Scientific/Engineering :: Information Analysis",
|
|
27
|
+
]
|
|
28
|
+
keywords = [
|
|
29
|
+
"ab-testing",
|
|
30
|
+
"monte-carlo",
|
|
31
|
+
"statistics",
|
|
32
|
+
"hypothesis-testing",
|
|
33
|
+
"experimentation",
|
|
34
|
+
"data-science",
|
|
35
|
+
"bootstrap",
|
|
36
|
+
"permutation-test",
|
|
37
|
+
"multiple-testing",
|
|
38
|
+
"experiments",
|
|
39
|
+
]
|
|
40
|
+
requires-python = ">=3.8"
|
|
41
|
+
dependencies = [
|
|
42
|
+
"numpy>=1.20.0",
|
|
43
|
+
"pandas>=1.3.0",
|
|
44
|
+
"scipy>=1.7.0",
|
|
45
|
+
"matplotlib>=3.4.0",
|
|
46
|
+
"seaborn>=0.11.0",
|
|
47
|
+
"joblib>=1.0.0",
|
|
48
|
+
"tqdm>=4.60.0",
|
|
49
|
+
"threadpoolctl>=3.0.0",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
[project.optional-dependencies]
|
|
53
|
+
dev = [
|
|
54
|
+
"pytest>=7.0.0",
|
|
55
|
+
"pytest-cov>=3.0.0",
|
|
56
|
+
"black>=22.0.0",
|
|
57
|
+
"flake8>=4.0.0",
|
|
58
|
+
"mypy>=0.950",
|
|
59
|
+
"isort>=5.10.0",
|
|
60
|
+
]
|
|
61
|
+
docs = [
|
|
62
|
+
"sphinx>=4.5.0",
|
|
63
|
+
"sphinx-rtd-theme>=1.0.0",
|
|
64
|
+
"numpydoc>=1.2.0",
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
[project.urls]
|
|
68
|
+
Homepage = "https://github.com/sslastochkin/mcab"
|
|
69
|
+
Documentation = "https://sslastochkin.github.io/mcab/"
|
|
70
|
+
Repository = "https://github.com/sslastochkin/mcab"
|
|
71
|
+
"Bug Tracker" = "https://github.com/sslastochkin/mcab/issues"
|
|
72
|
+
|
|
73
|
+
[tool.setuptools]
|
|
74
|
+
packages = ["mcab"]
|
|
75
|
+
package-dir = {"" = "src"}
|
|
76
|
+
|
|
77
|
+
[tool.setuptools.package-data]
|
|
78
|
+
mcab = ["py.typed"]
|
|
79
|
+
|
|
80
|
+
[tool.black]
|
|
81
|
+
line-length = 100
|
|
82
|
+
target-version = ['py38', 'py39', 'py310', 'py311']
|
|
83
|
+
|
|
84
|
+
[tool.isort]
|
|
85
|
+
profile = "black"
|
|
86
|
+
line_length = 100
|
|
87
|
+
|
|
88
|
+
[tool.mypy]
|
|
89
|
+
python_version = "3.8"
|
|
90
|
+
warn_return_any = true
|
|
91
|
+
warn_unused_configs = true
|
|
92
|
+
disallow_untyped_defs = false
|
|
93
|
+
|
|
94
|
+
[tool.pytest.ini_options]
|
|
95
|
+
testpaths = ["tests"]
|
|
96
|
+
python_files = ["test_*.py"]
|
|
97
|
+
python_classes = ["Test*"]
|
|
98
|
+
python_functions = ["test_*"]
|
|
99
|
+
addopts = "-v --cov=mcab --cov-report=html --cov-report=term"
|
mcab-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"""
|
|
2
|
+
mcab - Monte Carlo A/B Testing Library
|
|
3
|
+
========================================
|
|
4
|
+
|
|
5
|
+
A comprehensive Python library for A/B testing design and analysis using Monte Carlo simulations.
|
|
6
|
+
|
|
7
|
+
Main Components
|
|
8
|
+
---------------
|
|
9
|
+
- RandomData: Generate synthetic data for testing
|
|
10
|
+
- AaDataIid: Handle independent (user-aggregated) data
|
|
11
|
+
- AaDataRatio: Handle ratio metrics (CTR, average check, etc.)
|
|
12
|
+
- AaDataDept1s: Handle dependent one-sample data with an artificial control
|
|
13
|
+
- DesignerIid: Design A/B tests for independent data
|
|
14
|
+
- DesignerRatio: Design A/B tests for ratio metrics
|
|
15
|
+
- DesignerRatioLin: Design A/B tests for linearized ratio metrics
|
|
16
|
+
- DesignerDept1s: Design A/B tests for dependent one-sample data
|
|
17
|
+
- BenchMarker: Compare multiple A/B test designs
|
|
18
|
+
|
|
19
|
+
Statistical Tests
|
|
20
|
+
-----------------
|
|
21
|
+
- bootstrap_1s, bootstrap_2s: Bootstrap hypothesis tests
|
|
22
|
+
- sign_permutation_test: Paired permutation test
|
|
23
|
+
- permutation_test_2s: Two-sample permutation test
|
|
24
|
+
- multiple_pvalue_correction: Multiple testing corrections
|
|
25
|
+
|
|
26
|
+
Example Usage
|
|
27
|
+
-------------
|
|
28
|
+
>>> from mcab import RandomData, AaDataIid, DesignerIid
|
|
29
|
+
>>> from scipy import stats
|
|
30
|
+
>>>
|
|
31
|
+
>>> # Generate data
|
|
32
|
+
>>> rd = RandomData(seed=42)
|
|
33
|
+
>>> data = rd.normal_data(size=10000, mean=100, std=30)
|
|
34
|
+
>>>
|
|
35
|
+
>>> # Create designer
|
|
36
|
+
>>> target = AaDataIid(data)
|
|
37
|
+
>>> designer = DesignerIid(target, alpha=0.05)
|
|
38
|
+
>>>
|
|
39
|
+
>>> # Run AA simulations
|
|
40
|
+
>>> pvals = designer.aa_sims(
|
|
41
|
+
... pval_func=lambda t, c: stats.ttest_ind(t, c).pvalue,
|
|
42
|
+
... n_sims=1000
|
|
43
|
+
... )
|
|
44
|
+
>>>
|
|
45
|
+
>>> # Find MDE
|
|
46
|
+
>>> mde_result = designer.find_mde(
|
|
47
|
+
... pval_func=lambda t, c: stats.ttest_ind(t, c).pvalue,
|
|
48
|
+
... target_power=0.8
|
|
49
|
+
... )
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
__version__ = "0.1.0"
|
|
53
|
+
__author__ = "Sergey Lastochkin"
|
|
54
|
+
|
|
55
|
+
# Core classes
|
|
56
|
+
from .core import (
|
|
57
|
+
RandomData,
|
|
58
|
+
AaDataIid,
|
|
59
|
+
AaDataRatio,
|
|
60
|
+
AaDataDept1s,
|
|
61
|
+
DesignerIid,
|
|
62
|
+
DesignerRatio,
|
|
63
|
+
DesignerRatioLin,
|
|
64
|
+
DesignerDept1s,
|
|
65
|
+
BenchMarker,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
from .effects import (
|
|
69
|
+
PercentEffectSizer,
|
|
70
|
+
ConstantEffectSizer,
|
|
71
|
+
CustomEffectSizer,
|
|
72
|
+
FunctionEffectSizer
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
# Utility classes
|
|
76
|
+
from .utils import ProgressParallel
|
|
77
|
+
|
|
78
|
+
# Statistical functions
|
|
79
|
+
from .mstats import (
|
|
80
|
+
# Enums
|
|
81
|
+
Alternative,
|
|
82
|
+
# Utilities
|
|
83
|
+
apply_statistic,
|
|
84
|
+
# Bootstrap tests
|
|
85
|
+
bootstrap_1s,
|
|
86
|
+
bootstrap_2s,
|
|
87
|
+
# Permutation tests
|
|
88
|
+
sign_permutation_test,
|
|
89
|
+
permutation_test_2s,
|
|
90
|
+
# Multiple testing corrections
|
|
91
|
+
multiple_pvalue_correction,
|
|
92
|
+
CORRECTION_METHODS,
|
|
93
|
+
bonferroni,
|
|
94
|
+
holm_bonferroni,
|
|
95
|
+
hochberg,
|
|
96
|
+
benjamini_hochberg,
|
|
97
|
+
benjamini_yekutieli,
|
|
98
|
+
benjamini_krieger_yekutieli,
|
|
99
|
+
sidak,
|
|
100
|
+
holm_sidak,
|
|
101
|
+
no_multiple_correction,
|
|
102
|
+
delta_method_pvalue
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
__all__ = [
|
|
106
|
+
# Version
|
|
107
|
+
'__version__',
|
|
108
|
+
# Core classes
|
|
109
|
+
'RandomData',
|
|
110
|
+
'AaDataIid',
|
|
111
|
+
'AaDataRatio',
|
|
112
|
+
'AaDataDept1s',
|
|
113
|
+
'DesignerIid',
|
|
114
|
+
'DesignerRatio',
|
|
115
|
+
'DesignerRatioLin',
|
|
116
|
+
'DesignerDept1s',
|
|
117
|
+
'BenchMarker',
|
|
118
|
+
# Effects
|
|
119
|
+
'PercentEffectSizer',
|
|
120
|
+
'ConstantEffectSizer',
|
|
121
|
+
'CustomEffectSizer',
|
|
122
|
+
'FunctionEffectSizer',
|
|
123
|
+
# Utilities
|
|
124
|
+
'ProgressParallel',
|
|
125
|
+
# Enums
|
|
126
|
+
'Alternative',
|
|
127
|
+
# Statistical utilities
|
|
128
|
+
'apply_statistic',
|
|
129
|
+
# Bootstrap tests
|
|
130
|
+
'bootstrap_1s',
|
|
131
|
+
'bootstrap_2s',
|
|
132
|
+
# Permutation tests
|
|
133
|
+
'sign_permutation_test',
|
|
134
|
+
'permutation_test_2s',
|
|
135
|
+
# delta method
|
|
136
|
+
'delta_method_pvalue',
|
|
137
|
+
# Multiple testing
|
|
138
|
+
'multiple_pvalue_correction',
|
|
139
|
+
'CORRECTION_METHODS',
|
|
140
|
+
'bonferroni',
|
|
141
|
+
'holm_bonferroni',
|
|
142
|
+
'hochberg',
|
|
143
|
+
'benjamini_hochberg',
|
|
144
|
+
'benjamini_yekutieli',
|
|
145
|
+
'benjamini_krieger_yekutieli',
|
|
146
|
+
'sidak',
|
|
147
|
+
'holm_sidak',
|
|
148
|
+
'no_multiple_correction'
|
|
149
|
+
]
|