summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-10 05:38:35 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-10 05:38:35 +0000
commit572a04cecec3faff8c8d8449463c6a959d48afae (patch)
treeac286855f556157a82d8c1cc0f55d7caa7ce67bd
parent7683554592d8e35d3902e0a413d24dbcc6c38c9e (diff)
automatic import of python-rollingrankopeneuler20.03
-rw-r--r--.gitignore1
-rw-r--r--python-rollingrank.spec318
-rw-r--r--sources1
3 files changed, 320 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..1da37d1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/rollingrank-0.3.1.tar.gz
diff --git a/python-rollingrank.spec b/python-rollingrank.spec
new file mode 100644
index 0000000..336063e
--- /dev/null
+++ b/python-rollingrank.spec
@@ -0,0 +1,318 @@
+%global _empty_manifest_terminate_build 0
+Name: python-rollingrank
+Version: 0.3.1
+Release: 1
+Summary: fast rolling rank for numpy
+License: MIT
+URL: https://github.com/contribu/rollingrank
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/17/11/2a89a4b323f14ba51227b52e2fd12b10bdb6144d225a5cd84eeca1273f4d/rollingrank-0.3.1.tar.gz
+BuildArch: noarch
+
+
+%description
+## rollingrank
+
+rollingrank is a fast implementation of rolling rank transformation (described as the following code).
+
+```python
+import pandas as pd
+
+# x is numpy array
+def rollingrank(x, window=None):
+ def to_rank(x):
+ # result[i] is the rank of x[i] in x
+ return np.sum(np.less(x, x[-1]))
+ return pd.Series(x).rolling(window).apply(to_rank).values
+```
+
+## Motivation
+
+Rolling rank is a good tool to create features for time series prediction.
+However, rolling rank was not easy to use in python.
+There were no exact methods to do it.
+The simple implementation using pandas and numpy is too slow.
+
+## Performance
+
+|Implementation|Complexity|
+|:-:|:-:|
+|rollingrank|O(n * log(w))|
+|pandas rolling + numpy|O(n * w)|
+
+n: input length
+w: rolling window size
+
+## Install
+
+```bash
+pip install rollingrank
+```
+
+## Example
+
+```python
+import numpy as np
+import rollingrank
+
+x = np.array([0.1, 0.2, 0.3, 0.25, 0.1, 0.2, 0.3])
+y = rollingrank.rollingrank(x, window=3)
+print(y)
+# [nan nan 2. 1. 0. 1. 2.]
+
+y = rollingrank.rollingrank(x, window=3, pct=True)
+print(y)
+# [nan nan 1. 0.5 0. 0.5 1. ]
+```
+
+## rci
+
+RCI is also implemented because fast implementation is not found.
+
+https://docs.anychart.com/Stock_Charts/Technical_Indicators/Mathematical_Description#rank_correlation_index
+
+## Kaggle Example
+
+https://www.kaggle.com/bakuage/rollingrank-example
+
+## Development
+
+test
+
+```bash
+python -m unittest discover tests
+```
+
+build/upload
+
+```bash
+python setup.py sdist
+twine upload --repository pypitest dist/*
+twine upload --repository pypi dist/*
+```
+
+## TODO
+
+- support axis
+
+%package -n python3-rollingrank
+Summary: fast rolling rank for numpy
+Provides: python-rollingrank
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-rollingrank
+## rollingrank
+
+rollingrank is a fast implementation of rolling rank transformation (described as the following code).
+
+```python
+import pandas as pd
+
+# x is numpy array
+def rollingrank(x, window=None):
+ def to_rank(x):
+ # result[i] is the rank of x[i] in x
+ return np.sum(np.less(x, x[-1]))
+ return pd.Series(x).rolling(window).apply(to_rank).values
+```
+
+## Motivation
+
+Rolling rank is a good tool to create features for time series prediction.
+However, rolling rank was not easy to use in python.
+There were no exact methods to do it.
+The simple implementation using pandas and numpy is too slow.
+
+## Performance
+
+|Implementation|Complexity|
+|:-:|:-:|
+|rollingrank|O(n * log(w))|
+|pandas rolling + numpy|O(n * w)|
+
+n: input length
+w: rolling window size
+
+## Install
+
+```bash
+pip install rollingrank
+```
+
+## Example
+
+```python
+import numpy as np
+import rollingrank
+
+x = np.array([0.1, 0.2, 0.3, 0.25, 0.1, 0.2, 0.3])
+y = rollingrank.rollingrank(x, window=3)
+print(y)
+# [nan nan 2. 1. 0. 1. 2.]
+
+y = rollingrank.rollingrank(x, window=3, pct=True)
+print(y)
+# [nan nan 1. 0.5 0. 0.5 1. ]
+```
+
+## rci
+
+RCI is also implemented because fast implementation is not found.
+
+https://docs.anychart.com/Stock_Charts/Technical_Indicators/Mathematical_Description#rank_correlation_index
+
+## Kaggle Example
+
+https://www.kaggle.com/bakuage/rollingrank-example
+
+## Development
+
+test
+
+```bash
+python -m unittest discover tests
+```
+
+build/upload
+
+```bash
+python setup.py sdist
+twine upload --repository pypitest dist/*
+twine upload --repository pypi dist/*
+```
+
+## TODO
+
+- support axis
+
+%package help
+Summary: Development documents and examples for rollingrank
+Provides: python3-rollingrank-doc
+%description help
+## rollingrank
+
+rollingrank is a fast implementation of rolling rank transformation (described as the following code).
+
+```python
+import pandas as pd
+
+# x is numpy array
+def rollingrank(x, window=None):
+ def to_rank(x):
+ # result[i] is the rank of x[i] in x
+ return np.sum(np.less(x, x[-1]))
+ return pd.Series(x).rolling(window).apply(to_rank).values
+```
+
+## Motivation
+
+Rolling rank is a good tool to create features for time series prediction.
+However, rolling rank was not easy to use in python.
+There were no exact methods to do it.
+The simple implementation using pandas and numpy is too slow.
+
+## Performance
+
+|Implementation|Complexity|
+|:-:|:-:|
+|rollingrank|O(n * log(w))|
+|pandas rolling + numpy|O(n * w)|
+
+n: input length
+w: rolling window size
+
+## Install
+
+```bash
+pip install rollingrank
+```
+
+## Example
+
+```python
+import numpy as np
+import rollingrank
+
+x = np.array([0.1, 0.2, 0.3, 0.25, 0.1, 0.2, 0.3])
+y = rollingrank.rollingrank(x, window=3)
+print(y)
+# [nan nan 2. 1. 0. 1. 2.]
+
+y = rollingrank.rollingrank(x, window=3, pct=True)
+print(y)
+# [nan nan 1. 0.5 0. 0.5 1. ]
+```
+
+## rci
+
+RCI is also implemented because fast implementation is not found.
+
+https://docs.anychart.com/Stock_Charts/Technical_Indicators/Mathematical_Description#rank_correlation_index
+
+## Kaggle Example
+
+https://www.kaggle.com/bakuage/rollingrank-example
+
+## Development
+
+test
+
+```bash
+python -m unittest discover tests
+```
+
+build/upload
+
+```bash
+python setup.py sdist
+twine upload --repository pypitest dist/*
+twine upload --repository pypi dist/*
+```
+
+## TODO
+
+- support axis
+
+%prep
+%autosetup -n rollingrank-0.3.1
+
+%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-rollingrank -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.3.1-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..d19ef22
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+638ab931a01f311bd90d041d3e291791 rollingrank-0.3.1.tar.gz