diff options
Diffstat (limited to 'python-abito.spec')
-rw-r--r-- | python-abito.spec | 302 |
1 files changed, 302 insertions, 0 deletions
diff --git a/python-abito.spec b/python-abito.spec new file mode 100644 index 0000000..1e30269 --- /dev/null +++ b/python-abito.spec @@ -0,0 +1,302 @@ +%global _empty_manifest_terminate_build 0 +Name: python-abito +Version: 0.1.3 +Release: 1 +Summary: Package for hypothesis testing in A/B-experiments +License: MIT +URL: https://github.com/avito-tech/abito +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/7c/ad/8a631821b1f0d93d62f87ce0013d866ced16c3371b6be3df42c685256bc0/abito-0.1.3.tar.gz +BuildArch: noarch + +Requires: python3-numpy +Requires: python3-scipy + +%description +# abito +[](https://travis-ci.com/avito-tech/abito) +[](https://coveralls.io/github/avito-tech/abito?branch=master) + +Python package for hypothesis testing. Suitable for using in A/B-testing software. +Tested for Python >= 3.5. Based on numpy and scipy. + +##### Features +1. Convenient interface to run significance tests. +2. Support of ratio-samples. Linearization included (delta-method). +3. Bootstrapping: can measure significance of any statistic, even quantiles. Multiprocessing is supported. +4. Ntile-bucketing: compress samples to get better performance. +5. Trim: get rid of heavy tails. + + +## Installation +``` +pip install abito +``` + +## Usage + +The most powerful tool in this package is the Sample: +```python +import abito as ab +``` + +Let's draw some observations from Poisson distribution and initiate Sample instance from them. +```python +import numpy as np + +observations = np.random.poisson(1, size=10**6) +sample = ab.sample(observations) +``` + +Now we can calculate any statistic in numpy-way. +```python +print(sample.mean()) +print(sample.std()) +print(sample.quantile(q=[0.05, 0.95])) +``` + +To compare with other sample we can use t_test or mann_whitney_u_test: +```python +observations_control = np.random.poisson(1.005, size=10**6) +sample_control = Sample(observations_control) + +print(sample.t_test(sample_control)) +print(sample.mann_whitney_u_test(sample_control)) +``` + +### Bootstrap +Or we can use bootstrap to compare any statistic: +```python +sample.bootstrap_test(sample_control, stat='mean', n_iters=100) +``` + +To improve performance, it's better to provide observations in weighted form: unique values + counts. Or, we can compress samples, using built-in method: +```python +sample.reweigh(inplace=True) +sample_control.reweigh(inplace=True) +sample.bootstrap_test(sample_control, stat='mean', n_iters=10000) +``` +Now bootstrap is working lightning-fast. To improve performance further you can set parameter n_threads > 1 to run bootstrapping using multiprocessing. + +### Compress +```python +observations = np.random.normal(100, size=10**8) +sample = ab.sample(observations) + +compressed = sample.compress(n_buckets=100, stat='mean') + +%timeit sample.std() +%timeit compressed.std() +``` + + + +%package -n python3-abito +Summary: Package for hypothesis testing in A/B-experiments +Provides: python-abito +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-abito +# abito +[](https://travis-ci.com/avito-tech/abito) +[](https://coveralls.io/github/avito-tech/abito?branch=master) + +Python package for hypothesis testing. Suitable for using in A/B-testing software. +Tested for Python >= 3.5. Based on numpy and scipy. + +##### Features +1. Convenient interface to run significance tests. +2. Support of ratio-samples. Linearization included (delta-method). +3. Bootstrapping: can measure significance of any statistic, even quantiles. Multiprocessing is supported. +4. Ntile-bucketing: compress samples to get better performance. +5. Trim: get rid of heavy tails. + + +## Installation +``` +pip install abito +``` + +## Usage + +The most powerful tool in this package is the Sample: +```python +import abito as ab +``` + +Let's draw some observations from Poisson distribution and initiate Sample instance from them. +```python +import numpy as np + +observations = np.random.poisson(1, size=10**6) +sample = ab.sample(observations) +``` + +Now we can calculate any statistic in numpy-way. +```python +print(sample.mean()) +print(sample.std()) +print(sample.quantile(q=[0.05, 0.95])) +``` + +To compare with other sample we can use t_test or mann_whitney_u_test: +```python +observations_control = np.random.poisson(1.005, size=10**6) +sample_control = Sample(observations_control) + +print(sample.t_test(sample_control)) +print(sample.mann_whitney_u_test(sample_control)) +``` + +### Bootstrap +Or we can use bootstrap to compare any statistic: +```python +sample.bootstrap_test(sample_control, stat='mean', n_iters=100) +``` + +To improve performance, it's better to provide observations in weighted form: unique values + counts. Or, we can compress samples, using built-in method: +```python +sample.reweigh(inplace=True) +sample_control.reweigh(inplace=True) +sample.bootstrap_test(sample_control, stat='mean', n_iters=10000) +``` +Now bootstrap is working lightning-fast. To improve performance further you can set parameter n_threads > 1 to run bootstrapping using multiprocessing. + +### Compress +```python +observations = np.random.normal(100, size=10**8) +sample = ab.sample(observations) + +compressed = sample.compress(n_buckets=100, stat='mean') + +%timeit sample.std() +%timeit compressed.std() +``` + + + +%package help +Summary: Development documents and examples for abito +Provides: python3-abito-doc +%description help +# abito +[](https://travis-ci.com/avito-tech/abito) +[](https://coveralls.io/github/avito-tech/abito?branch=master) + +Python package for hypothesis testing. Suitable for using in A/B-testing software. +Tested for Python >= 3.5. Based on numpy and scipy. + +##### Features +1. Convenient interface to run significance tests. +2. Support of ratio-samples. Linearization included (delta-method). +3. Bootstrapping: can measure significance of any statistic, even quantiles. Multiprocessing is supported. +4. Ntile-bucketing: compress samples to get better performance. +5. Trim: get rid of heavy tails. + + +## Installation +``` +pip install abito +``` + +## Usage + +The most powerful tool in this package is the Sample: +```python +import abito as ab +``` + +Let's draw some observations from Poisson distribution and initiate Sample instance from them. +```python +import numpy as np + +observations = np.random.poisson(1, size=10**6) +sample = ab.sample(observations) +``` + +Now we can calculate any statistic in numpy-way. +```python +print(sample.mean()) +print(sample.std()) +print(sample.quantile(q=[0.05, 0.95])) +``` + +To compare with other sample we can use t_test or mann_whitney_u_test: +```python +observations_control = np.random.poisson(1.005, size=10**6) +sample_control = Sample(observations_control) + +print(sample.t_test(sample_control)) +print(sample.mann_whitney_u_test(sample_control)) +``` + +### Bootstrap +Or we can use bootstrap to compare any statistic: +```python +sample.bootstrap_test(sample_control, stat='mean', n_iters=100) +``` + +To improve performance, it's better to provide observations in weighted form: unique values + counts. Or, we can compress samples, using built-in method: +```python +sample.reweigh(inplace=True) +sample_control.reweigh(inplace=True) +sample.bootstrap_test(sample_control, stat='mean', n_iters=10000) +``` +Now bootstrap is working lightning-fast. To improve performance further you can set parameter n_threads > 1 to run bootstrapping using multiprocessing. + +### Compress +```python +observations = np.random.normal(100, size=10**8) +sample = ab.sample(observations) + +compressed = sample.compress(n_buckets=100, stat='mean') + +%timeit sample.std() +%timeit compressed.std() +``` + + + +%prep +%autosetup -n abito-0.1.3 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-abito -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 31 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.3-1 +- Package Spec generated |