diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-04-12 05:19:55 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-04-12 05:19:55 +0000 |
| commit | d75d04c62194ac40adea34a1800dcd8e784aa28d (patch) | |
| tree | bb24f7d03eb88b8d51c2cde9aa7acc42bb4f2f0e | |
| parent | 15c912199f323fcc6d42e2ac49c6fa48a8f82b71 (diff) | |
automatic import of python-robustats
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-robustats.spec | 393 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 395 insertions, 0 deletions
@@ -0,0 +1 @@ +/robustats-0.1.7.tar.gz diff --git a/python-robustats.spec b/python-robustats.spec new file mode 100644 index 0000000..cf52456 --- /dev/null +++ b/python-robustats.spec @@ -0,0 +1,393 @@ +%global _empty_manifest_terminate_build 0 +Name: python-robustats +Version: 0.1.7 +Release: 1 +Summary: Robustats is a Python library for high-performance computation of robust statistical estimators. +License: MIT +URL: https://github.com/FilippoBovo/robustats +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/10/e1/64507951c10912a423239c10b3842eea284951c083a1c12882cd3b147f84/robustats-0.1.7.tar.gz +BuildArch: noarch + + +%description +# Robustats + +Robustats is a Python library for high-performance computation of robust statistical estimators. + +The functions that compute the robust estimators are [implemented in C](c) for speed and [called by Python](robustats). + +Estimators implemented in the library: + +- **Weighted Median** (temporal complexity: `O(n)`) \[1, 2, 3\] +- **Medcouple** (temporal complexity: `O(n * log(n))`) [4, 5, 6, 7] +- **Mode** (temporal complexity: `O(n * log(n))`) [8] + +## How to Install + +This library requires Python 3. + +You can install the library using Pip. + +```shell +pip install robustats +``` + +You can also install the library directly from GitHub using the following command. + +```shell +pip install -e 'git+https://github.com/FilippoBovo/robustats.git#egg=robustats' +``` + +Otherwise, you may clone the repository, and install and test the Robustats package in the following way. + +```shell +git clone https://github.com/FilippoBovo/robustats.git +cd robustats +pip install -e . +python -m unittest +``` + +## How to Use + +This is an example of how to use the Robustats library in Python. + +```python +import numpy as np +import robustats + + +# Weighted Median +x = np.array([1.1, 5.3, 3.7, 2.1, 7.0, 9.9]) +weights = np.array([1.1, 0.4, 2.1, 3.5, 1.2, 0.8]) + +weighted_median = robustats.weighted_median(x, weights) + +print("The weighted median is {}".format(weighted_median)) +# Output: The weighted median is 2.1 + + +# Medcouple +x = np.array([0.2, 0.17, 0.08, 0.16, 0.88, 0.86, 0.09, 0.54, 0.27, 0.14]) + +medcouple = robustats.medcouple(x) + +print("The medcouple is {}".format(medcouple)) +# Output: The medcouple is 0.7749999999999999 + + +# Mode +x = np.array([1., 2., 2., 3., 3., 3., 4., 4., 5.]) + +mode = robustats.mode(x) + +print("The mode is {}".format(mode)) +# Output: The mode is 3.0 +``` + +## How to Contribute + +If you wish to contribute to this library, please follow the patterns and style of the rest of the code. + +Moreover, install the Git hooks. + +```shell +git config core.hooksPath .githooks +``` + + + +Tips: + +- In C, use `malloc` to allocate memory to the heap, instead of creating arrays that allocate memory to the stack, as with large array we would incur in a [segmentation fault due to stack overflow](https://stackoverflow.com/a/1847886). +- Avoid recursions where possible to limit the spatial complexity of the problem. In place of recursions, use loops. + +## References + +\[1\] [Cormen, Leiserson, Rivest, Stein - Introduction to Algorithms (3rd Edition)](https://books.google.co.uk/books?id=aefUBQAAQBAJ&lpg=PR5&ots=dN8rWuZQaW&dq=Cormen%2C%20Leiserson%2C%20Rivest%2C%20Stein%20-%20Introduction%20to%20Algorithms&lr&pg=PP1#v=onepage&q&f=false). + +\[2\] [Cormen - Introduction to Algorithms (3rd Edition) - Instructor's Manual](https://cdn.manesht.ir/19908/Introduction%20to%20Algorithms.pdf). + +\[3\] [Weighted median on Wikipedia](https://en.wikipedia.org/wiki/Weighted_median). + +\[4\] [G. Brys; M. Hubert; A. Struyf (November 2004). "A Robust Measure of Skewness". *Journal of Computational and Graphical Statistics*. **13** (4): 996–1017.](https://doi.org/10.1198%2F106186004X12632) + +\[5\] [Donald B. Johnson; Tetsuo Mizoguchi (May 1978). "Selecting The Kth Element In X + Y And X1 + X2 +...+ Xm". *SIAM Journal on Computing*. **7** (2): 147–153.](https://doi.org/10.1137%2F0207013) + +\[6\] [Medcouple implementation in Python by Jordi Gutiérrez Hermoso.](http://inversethought.com/hg/) + +\[7\] [Medcouple on Wikipedia.](https://en.wikipedia.org/wiki/Medcouple) + +\[8\] [David R. Bickel, Rudolf Frühwirth. "On a fast, robust estimator of the mode: Comparisons to other robust estimators with applications", *Computational Statistics & Data Analysis*, Volume 50, Issue 12, 2006, Pages 3500-3530, ISSN 0167-9473.](https://doi.org/10.1016/j.csda.2005.07.011) + +%package -n python3-robustats +Summary: Robustats is a Python library for high-performance computation of robust statistical estimators. +Provides: python-robustats +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-robustats +# Robustats + +Robustats is a Python library for high-performance computation of robust statistical estimators. + +The functions that compute the robust estimators are [implemented in C](c) for speed and [called by Python](robustats). + +Estimators implemented in the library: + +- **Weighted Median** (temporal complexity: `O(n)`) \[1, 2, 3\] +- **Medcouple** (temporal complexity: `O(n * log(n))`) [4, 5, 6, 7] +- **Mode** (temporal complexity: `O(n * log(n))`) [8] + +## How to Install + +This library requires Python 3. + +You can install the library using Pip. + +```shell +pip install robustats +``` + +You can also install the library directly from GitHub using the following command. + +```shell +pip install -e 'git+https://github.com/FilippoBovo/robustats.git#egg=robustats' +``` + +Otherwise, you may clone the repository, and install and test the Robustats package in the following way. + +```shell +git clone https://github.com/FilippoBovo/robustats.git +cd robustats +pip install -e . +python -m unittest +``` + +## How to Use + +This is an example of how to use the Robustats library in Python. + +```python +import numpy as np +import robustats + + +# Weighted Median +x = np.array([1.1, 5.3, 3.7, 2.1, 7.0, 9.9]) +weights = np.array([1.1, 0.4, 2.1, 3.5, 1.2, 0.8]) + +weighted_median = robustats.weighted_median(x, weights) + +print("The weighted median is {}".format(weighted_median)) +# Output: The weighted median is 2.1 + + +# Medcouple +x = np.array([0.2, 0.17, 0.08, 0.16, 0.88, 0.86, 0.09, 0.54, 0.27, 0.14]) + +medcouple = robustats.medcouple(x) + +print("The medcouple is {}".format(medcouple)) +# Output: The medcouple is 0.7749999999999999 + + +# Mode +x = np.array([1., 2., 2., 3., 3., 3., 4., 4., 5.]) + +mode = robustats.mode(x) + +print("The mode is {}".format(mode)) +# Output: The mode is 3.0 +``` + +## How to Contribute + +If you wish to contribute to this library, please follow the patterns and style of the rest of the code. + +Moreover, install the Git hooks. + +```shell +git config core.hooksPath .githooks +``` + + + +Tips: + +- In C, use `malloc` to allocate memory to the heap, instead of creating arrays that allocate memory to the stack, as with large array we would incur in a [segmentation fault due to stack overflow](https://stackoverflow.com/a/1847886). +- Avoid recursions where possible to limit the spatial complexity of the problem. In place of recursions, use loops. + +## References + +\[1\] [Cormen, Leiserson, Rivest, Stein - Introduction to Algorithms (3rd Edition)](https://books.google.co.uk/books?id=aefUBQAAQBAJ&lpg=PR5&ots=dN8rWuZQaW&dq=Cormen%2C%20Leiserson%2C%20Rivest%2C%20Stein%20-%20Introduction%20to%20Algorithms&lr&pg=PP1#v=onepage&q&f=false). + +\[2\] [Cormen - Introduction to Algorithms (3rd Edition) - Instructor's Manual](https://cdn.manesht.ir/19908/Introduction%20to%20Algorithms.pdf). + +\[3\] [Weighted median on Wikipedia](https://en.wikipedia.org/wiki/Weighted_median). + +\[4\] [G. Brys; M. Hubert; A. Struyf (November 2004). "A Robust Measure of Skewness". *Journal of Computational and Graphical Statistics*. **13** (4): 996–1017.](https://doi.org/10.1198%2F106186004X12632) + +\[5\] [Donald B. Johnson; Tetsuo Mizoguchi (May 1978). "Selecting The Kth Element In X + Y And X1 + X2 +...+ Xm". *SIAM Journal on Computing*. **7** (2): 147–153.](https://doi.org/10.1137%2F0207013) + +\[6\] [Medcouple implementation in Python by Jordi Gutiérrez Hermoso.](http://inversethought.com/hg/) + +\[7\] [Medcouple on Wikipedia.](https://en.wikipedia.org/wiki/Medcouple) + +\[8\] [David R. Bickel, Rudolf Frühwirth. "On a fast, robust estimator of the mode: Comparisons to other robust estimators with applications", *Computational Statistics & Data Analysis*, Volume 50, Issue 12, 2006, Pages 3500-3530, ISSN 0167-9473.](https://doi.org/10.1016/j.csda.2005.07.011) + +%package help +Summary: Development documents and examples for robustats +Provides: python3-robustats-doc +%description help +# Robustats + +Robustats is a Python library for high-performance computation of robust statistical estimators. + +The functions that compute the robust estimators are [implemented in C](c) for speed and [called by Python](robustats). + +Estimators implemented in the library: + +- **Weighted Median** (temporal complexity: `O(n)`) \[1, 2, 3\] +- **Medcouple** (temporal complexity: `O(n * log(n))`) [4, 5, 6, 7] +- **Mode** (temporal complexity: `O(n * log(n))`) [8] + +## How to Install + +This library requires Python 3. + +You can install the library using Pip. + +```shell +pip install robustats +``` + +You can also install the library directly from GitHub using the following command. + +```shell +pip install -e 'git+https://github.com/FilippoBovo/robustats.git#egg=robustats' +``` + +Otherwise, you may clone the repository, and install and test the Robustats package in the following way. + +```shell +git clone https://github.com/FilippoBovo/robustats.git +cd robustats +pip install -e . +python -m unittest +``` + +## How to Use + +This is an example of how to use the Robustats library in Python. + +```python +import numpy as np +import robustats + + +# Weighted Median +x = np.array([1.1, 5.3, 3.7, 2.1, 7.0, 9.9]) +weights = np.array([1.1, 0.4, 2.1, 3.5, 1.2, 0.8]) + +weighted_median = robustats.weighted_median(x, weights) + +print("The weighted median is {}".format(weighted_median)) +# Output: The weighted median is 2.1 + + +# Medcouple +x = np.array([0.2, 0.17, 0.08, 0.16, 0.88, 0.86, 0.09, 0.54, 0.27, 0.14]) + +medcouple = robustats.medcouple(x) + +print("The medcouple is {}".format(medcouple)) +# Output: The medcouple is 0.7749999999999999 + + +# Mode +x = np.array([1., 2., 2., 3., 3., 3., 4., 4., 5.]) + +mode = robustats.mode(x) + +print("The mode is {}".format(mode)) +# Output: The mode is 3.0 +``` + +## How to Contribute + +If you wish to contribute to this library, please follow the patterns and style of the rest of the code. + +Moreover, install the Git hooks. + +```shell +git config core.hooksPath .githooks +``` + + + +Tips: + +- In C, use `malloc` to allocate memory to the heap, instead of creating arrays that allocate memory to the stack, as with large array we would incur in a [segmentation fault due to stack overflow](https://stackoverflow.com/a/1847886). +- Avoid recursions where possible to limit the spatial complexity of the problem. In place of recursions, use loops. + +## References + +\[1\] [Cormen, Leiserson, Rivest, Stein - Introduction to Algorithms (3rd Edition)](https://books.google.co.uk/books?id=aefUBQAAQBAJ&lpg=PR5&ots=dN8rWuZQaW&dq=Cormen%2C%20Leiserson%2C%20Rivest%2C%20Stein%20-%20Introduction%20to%20Algorithms&lr&pg=PP1#v=onepage&q&f=false). + +\[2\] [Cormen - Introduction to Algorithms (3rd Edition) - Instructor's Manual](https://cdn.manesht.ir/19908/Introduction%20to%20Algorithms.pdf). + +\[3\] [Weighted median on Wikipedia](https://en.wikipedia.org/wiki/Weighted_median). + +\[4\] [G. Brys; M. Hubert; A. Struyf (November 2004). "A Robust Measure of Skewness". *Journal of Computational and Graphical Statistics*. **13** (4): 996–1017.](https://doi.org/10.1198%2F106186004X12632) + +\[5\] [Donald B. Johnson; Tetsuo Mizoguchi (May 1978). "Selecting The Kth Element In X + Y And X1 + X2 +...+ Xm". *SIAM Journal on Computing*. **7** (2): 147–153.](https://doi.org/10.1137%2F0207013) + +\[6\] [Medcouple implementation in Python by Jordi Gutiérrez Hermoso.](http://inversethought.com/hg/) + +\[7\] [Medcouple on Wikipedia.](https://en.wikipedia.org/wiki/Medcouple) + +\[8\] [David R. Bickel, Rudolf Frühwirth. "On a fast, robust estimator of the mode: Comparisons to other robust estimators with applications", *Computational Statistics & Data Analysis*, Volume 50, Issue 12, 2006, Pages 3500-3530, ISSN 0167-9473.](https://doi.org/10.1016/j.csda.2005.07.011) + +%prep +%autosetup -n robustats-0.1.7 + +%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-robustats -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.7-1 +- Package Spec generated @@ -0,0 +1 @@ +5a9650d2ba3b56bc38a227f5fbdc896a robustats-0.1.7.tar.gz |
