summaryrefslogtreecommitdiff
path: root/python-cwgp.spec
diff options
context:
space:
mode:
Diffstat (limited to 'python-cwgp.spec')
-rw-r--r--python-cwgp.spec368
1 files changed, 368 insertions, 0 deletions
diff --git a/python-cwgp.spec b/python-cwgp.spec
new file mode 100644
index 0000000..98763bd
--- /dev/null
+++ b/python-cwgp.spec
@@ -0,0 +1,368 @@
+%global _empty_manifest_terminate_build 0
+Name: python-CWGP
+Version: 2.0.7
+Release: 1
+Summary: CWGP
+License: MIT License
+URL: https://github.com/andy971022/CWGP
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/2c/ef/7ed0587f6d2bfbb6fda1b2bbb28bf6cb063f1371cb726d5242914a4e9ebc/CWGP-2.0.7.tar.gz
+BuildArch: noarch
+
+Requires: python3-autograd
+Requires: python3-scipy
+Requires: python3-tqdm
+Requires: python3-numpy
+Requires: python3-gpy
+
+%description
+# Compositionally Warped Gaussian Processes
+This package is dedicated to realizing methods used in this [paper](https://arxiv.org/abs/1906.09665).
+
+
+## TLDR;
+A package that transforms anything to a Gaussian distribution.
+
+## Tutorial
+
+Visit [here](./examples/cwgp_beta.ipynb)
+
+## Installation
+`pip install CWGP`
+
+## Quick Start
+
+Let's randomly generate 100 numbers following an exponential distribution.
+``` python
+import numpy as np
+import seaborn as sns
+import matplotlib.pyplot as plt
+
+exp = np.random.exponential(scale=5, size=50)
+idx = np.arange(50)
+```
+![](./images/1.png)
+
+We now instantiate a CWGP class consisting of 3 Sinh-Arcsinh transformations.
+``` python
+from cwgp.cwgp import CWGP
+
+compgp = CWGP(["sa","box_cox"])
+```
+
+We then fit our data into the model. This minimizes the negative log likelihood function and stores the corresponding parameters for us.
+``` python
+compgp.fit(exp, idx)
+```
+
+To get the parameters, we do
+``` python
+params = compgp.phi.res.x
+```
+
+We then transform the data via
+
+``` python
+t_exp, d = compgp.phi.comp_phi(params, exp)
+sns.distplot(t_exp)
+plt.show()
+```
+![](./images/2.png)
+
+Let's make a QQ-plot and see how Gaussian it is.
+``` python
+from scipy import stats
+
+stats.probplot(t_exp, dist="norm", plot=plt)
+plt.show()
+```
+![](./images/3.png)
+
+The inverse function is also implemented.
+``` python
+inv_t_exp = compgp.phi.inv_comp_phi(params, t_exp)
+```
+
+``` python
+fig, ax = plt.subplots(1, 2)
+sns.distplot(inv_t_exp, ax=ax[0])
+sns.distplot(exp, ax=ax[1])
+plt.show()
+```
+
+The one on the left is the one being transformed and transformed-back, and the one on the right is the original distribution.
+They should be exactly the same.
+![](./images/4.png)
+
+## Transformations
+
+### Sinh-Arcsinh (sa)
+
+`from cwgp.transformations import sa`
+
+### Arcsinh (asinh)
+
+`from cwgp.transformations import asinh`
+
+### Box-Cox (box_cox)
+
+`from cwgp.transformations import box_cox`
+
+### Sinh-Arcsinh and Affine (SAL)
+
+`from cwgp.transformations import sal`
+
+
+
+
+%package -n python3-CWGP
+Summary: CWGP
+Provides: python-CWGP
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-CWGP
+# Compositionally Warped Gaussian Processes
+This package is dedicated to realizing methods used in this [paper](https://arxiv.org/abs/1906.09665).
+
+
+## TLDR;
+A package that transforms anything to a Gaussian distribution.
+
+## Tutorial
+
+Visit [here](./examples/cwgp_beta.ipynb)
+
+## Installation
+`pip install CWGP`
+
+## Quick Start
+
+Let's randomly generate 100 numbers following an exponential distribution.
+``` python
+import numpy as np
+import seaborn as sns
+import matplotlib.pyplot as plt
+
+exp = np.random.exponential(scale=5, size=50)
+idx = np.arange(50)
+```
+![](./images/1.png)
+
+We now instantiate a CWGP class consisting of 3 Sinh-Arcsinh transformations.
+``` python
+from cwgp.cwgp import CWGP
+
+compgp = CWGP(["sa","box_cox"])
+```
+
+We then fit our data into the model. This minimizes the negative log likelihood function and stores the corresponding parameters for us.
+``` python
+compgp.fit(exp, idx)
+```
+
+To get the parameters, we do
+``` python
+params = compgp.phi.res.x
+```
+
+We then transform the data via
+
+``` python
+t_exp, d = compgp.phi.comp_phi(params, exp)
+sns.distplot(t_exp)
+plt.show()
+```
+![](./images/2.png)
+
+Let's make a QQ-plot and see how Gaussian it is.
+``` python
+from scipy import stats
+
+stats.probplot(t_exp, dist="norm", plot=plt)
+plt.show()
+```
+![](./images/3.png)
+
+The inverse function is also implemented.
+``` python
+inv_t_exp = compgp.phi.inv_comp_phi(params, t_exp)
+```
+
+``` python
+fig, ax = plt.subplots(1, 2)
+sns.distplot(inv_t_exp, ax=ax[0])
+sns.distplot(exp, ax=ax[1])
+plt.show()
+```
+
+The one on the left is the one being transformed and transformed-back, and the one on the right is the original distribution.
+They should be exactly the same.
+![](./images/4.png)
+
+## Transformations
+
+### Sinh-Arcsinh (sa)
+
+`from cwgp.transformations import sa`
+
+### Arcsinh (asinh)
+
+`from cwgp.transformations import asinh`
+
+### Box-Cox (box_cox)
+
+`from cwgp.transformations import box_cox`
+
+### Sinh-Arcsinh and Affine (SAL)
+
+`from cwgp.transformations import sal`
+
+
+
+
+%package help
+Summary: Development documents and examples for CWGP
+Provides: python3-CWGP-doc
+%description help
+# Compositionally Warped Gaussian Processes
+This package is dedicated to realizing methods used in this [paper](https://arxiv.org/abs/1906.09665).
+
+
+## TLDR;
+A package that transforms anything to a Gaussian distribution.
+
+## Tutorial
+
+Visit [here](./examples/cwgp_beta.ipynb)
+
+## Installation
+`pip install CWGP`
+
+## Quick Start
+
+Let's randomly generate 100 numbers following an exponential distribution.
+``` python
+import numpy as np
+import seaborn as sns
+import matplotlib.pyplot as plt
+
+exp = np.random.exponential(scale=5, size=50)
+idx = np.arange(50)
+```
+![](./images/1.png)
+
+We now instantiate a CWGP class consisting of 3 Sinh-Arcsinh transformations.
+``` python
+from cwgp.cwgp import CWGP
+
+compgp = CWGP(["sa","box_cox"])
+```
+
+We then fit our data into the model. This minimizes the negative log likelihood function and stores the corresponding parameters for us.
+``` python
+compgp.fit(exp, idx)
+```
+
+To get the parameters, we do
+``` python
+params = compgp.phi.res.x
+```
+
+We then transform the data via
+
+``` python
+t_exp, d = compgp.phi.comp_phi(params, exp)
+sns.distplot(t_exp)
+plt.show()
+```
+![](./images/2.png)
+
+Let's make a QQ-plot and see how Gaussian it is.
+``` python
+from scipy import stats
+
+stats.probplot(t_exp, dist="norm", plot=plt)
+plt.show()
+```
+![](./images/3.png)
+
+The inverse function is also implemented.
+``` python
+inv_t_exp = compgp.phi.inv_comp_phi(params, t_exp)
+```
+
+``` python
+fig, ax = plt.subplots(1, 2)
+sns.distplot(inv_t_exp, ax=ax[0])
+sns.distplot(exp, ax=ax[1])
+plt.show()
+```
+
+The one on the left is the one being transformed and transformed-back, and the one on the right is the original distribution.
+They should be exactly the same.
+![](./images/4.png)
+
+## Transformations
+
+### Sinh-Arcsinh (sa)
+
+`from cwgp.transformations import sa`
+
+### Arcsinh (asinh)
+
+`from cwgp.transformations import asinh`
+
+### Box-Cox (box_cox)
+
+`from cwgp.transformations import box_cox`
+
+### Sinh-Arcsinh and Affine (SAL)
+
+`from cwgp.transformations import sal`
+
+
+
+
+%prep
+%autosetup -n CWGP-2.0.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-CWGP -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 2.0.7-1
+- Package Spec generated