summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-06-20 06:02:55 +0000
committerCoprDistGit <infra@openeuler.org>2023-06-20 06:02:55 +0000
commitde790dc901fcf577a3860e9004218abd94babf41 (patch)
tree1a6875c1133d50b18bab1a18f8313963c933ec5b
parent56f9c304de397c780fbb4f4e4dda020fdb5c1393 (diff)
automatic import of python-Constrained-GaussianProcessopeneuler20.03
-rw-r--r--.gitignore1
-rw-r--r--python-constrained-gaussianprocess.spec360
-rw-r--r--sources1
3 files changed, 362 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..203da68 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/Constrained_GaussianProcess-0.1.1.tar.gz
diff --git a/python-constrained-gaussianprocess.spec b/python-constrained-gaussianprocess.spec
new file mode 100644
index 0000000..2e74142
--- /dev/null
+++ b/python-constrained-gaussianprocess.spec
@@ -0,0 +1,360 @@
+%global _empty_manifest_terminate_build 0
+Name: python-Constrained-GaussianProcess
+Version: 0.1.1
+Release: 1
+Summary: Implementation of Python package for Fitting and Inference of Linearly Constrained Gaussian Processes
+License: MIT License
+URL: https://gitlab.inf.ethz.ch/mmutny/contrained-gps
+Source0: https://mirrors.aliyun.com/pypi/web/packages/15/2f/0ec2f0aa5eeb68b4560e32a7e97038d22189bb466271d54709972e250bb2/Constrained_GaussianProcess-0.1.1.tar.gz
+BuildArch: noarch
+
+
+%description
+# Constrained_GaussianProcess
+
+Constrained_GaussianProcess is able to deal with linear inequality constraints in Gaussian Process frameworks. Check out the paper [Finite-Dimensional Gaussian Approximation with Linear Inequality Constraints](https://epubs.siam.org/doi/pdf/10.1137/17M1153157) for a detail explanation.
+
+![A toy example](https://github.com/liaowangh/LeetCode/raw/master/HMC.png)
+
+There are also [Hamiltonian Monte Carlo](https://arxiv.org/abs/1208.4118) method and Gibbs sampling method to sample from truncated multivariate Gaussian.
+
+
+
+## Requirement
+
+The code requires [Python 3.7](https://www.python.org/downloads/release/python-373/) , as well as the following python libraries:
+
+- [cvxpy](https://www.cvxpy.org/#)==1.0.25
+- numpy==1.17.3
+- scipy==1.2.1
+
+Those modules can be installed using: `pip install numpy scipy cvxpy` or `pip install -r requirements.txt`.
+
+
+
+## Installation
+
+Use the package manager [pip](https://pip.pypa.io/en/stable/) to install Constrained_GaussianProcess.
+
+```bash
+pip install Constrained-GaussianProcess
+```
+
+
+
+## Usage
+
+
+
+```python
+from Constrained_GaussianProcess import ConstrainedGP
+m=30
+# specify the constraints
+constraints={'increasing': True, 'bounded': [0,1], 'convex': False}
+interval=[0,1]
+Gp = ConstrainedGP(m, constraints=constraints, interval=interval)
+
+# Training data
+x_train = np.array([0.25, 0.5, 0.75])
+y_train = norm().cdf((x-0.5)/0.2)
+
+# the MCMC methods are used to approximate the posterior distribution,
+# so apart from training data, 'method' ('HMC' or 'Gibbs'), required number of samples
+# 'n' and the burn in numbers 'burn_in' should be specified when fitting the data.
+Gp.fit_gp(x_train, y_train, n=100, burn_in=100, method='HMC')
+
+x_test = np.arange(0, 1 + 0.01, 0.5)
+y_pred = Gp.mean(x_test) # get the conditional mean
+```
+
+Sampling from <img src="https://render.githubusercontent.com/render/math?math=X\sim \mathcal{N}(\mu, \Sigma)"> with constraints ![f\cdot X+g\ge 0](https://render.githubusercontent.com/render/math?math=f%5Ccdot%20X%2Bg%5Cge%200)
+
+```python
+from Constrained_GaussianProcess import tmg
+
+# set the number of samples and number in burn in phase
+n = 150
+burn_in = 30
+
+#Define the covariance matrix and mean vector
+M = np.array([[0.5, -0.4], [-0.4, 0.5]])
+mu = np.array([0,0])
+
+# Set initial point for the Markov chain
+initial = np.array([4,1])
+
+# Define two linear constraints
+f = np.array([[1,1],[1,0]])
+g = np.array([0,0])
+
+# Sample
+samples = tmg(n, mu, M, initial, f, g, burn_in=burn_in)
+```
+
+
+
+
+
+## Acknowledment
+
+The `HMC` method for MCMC is based on the R package [tmg](https://cran.r-project.org/web/packages/tmg/index.html).
+
+
+
+## License
+
+[MIT](https://choosealicense.com/licenses/mit/)
+
+
+
+
+%package -n python3-Constrained-GaussianProcess
+Summary: Implementation of Python package for Fitting and Inference of Linearly Constrained Gaussian Processes
+Provides: python-Constrained-GaussianProcess
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-Constrained-GaussianProcess
+# Constrained_GaussianProcess
+
+Constrained_GaussianProcess is able to deal with linear inequality constraints in Gaussian Process frameworks. Check out the paper [Finite-Dimensional Gaussian Approximation with Linear Inequality Constraints](https://epubs.siam.org/doi/pdf/10.1137/17M1153157) for a detail explanation.
+
+![A toy example](https://github.com/liaowangh/LeetCode/raw/master/HMC.png)
+
+There are also [Hamiltonian Monte Carlo](https://arxiv.org/abs/1208.4118) method and Gibbs sampling method to sample from truncated multivariate Gaussian.
+
+
+
+## Requirement
+
+The code requires [Python 3.7](https://www.python.org/downloads/release/python-373/) , as well as the following python libraries:
+
+- [cvxpy](https://www.cvxpy.org/#)==1.0.25
+- numpy==1.17.3
+- scipy==1.2.1
+
+Those modules can be installed using: `pip install numpy scipy cvxpy` or `pip install -r requirements.txt`.
+
+
+
+## Installation
+
+Use the package manager [pip](https://pip.pypa.io/en/stable/) to install Constrained_GaussianProcess.
+
+```bash
+pip install Constrained-GaussianProcess
+```
+
+
+
+## Usage
+
+
+
+```python
+from Constrained_GaussianProcess import ConstrainedGP
+m=30
+# specify the constraints
+constraints={'increasing': True, 'bounded': [0,1], 'convex': False}
+interval=[0,1]
+Gp = ConstrainedGP(m, constraints=constraints, interval=interval)
+
+# Training data
+x_train = np.array([0.25, 0.5, 0.75])
+y_train = norm().cdf((x-0.5)/0.2)
+
+# the MCMC methods are used to approximate the posterior distribution,
+# so apart from training data, 'method' ('HMC' or 'Gibbs'), required number of samples
+# 'n' and the burn in numbers 'burn_in' should be specified when fitting the data.
+Gp.fit_gp(x_train, y_train, n=100, burn_in=100, method='HMC')
+
+x_test = np.arange(0, 1 + 0.01, 0.5)
+y_pred = Gp.mean(x_test) # get the conditional mean
+```
+
+Sampling from <img src="https://render.githubusercontent.com/render/math?math=X\sim \mathcal{N}(\mu, \Sigma)"> with constraints ![f\cdot X+g\ge 0](https://render.githubusercontent.com/render/math?math=f%5Ccdot%20X%2Bg%5Cge%200)
+
+```python
+from Constrained_GaussianProcess import tmg
+
+# set the number of samples and number in burn in phase
+n = 150
+burn_in = 30
+
+#Define the covariance matrix and mean vector
+M = np.array([[0.5, -0.4], [-0.4, 0.5]])
+mu = np.array([0,0])
+
+# Set initial point for the Markov chain
+initial = np.array([4,1])
+
+# Define two linear constraints
+f = np.array([[1,1],[1,0]])
+g = np.array([0,0])
+
+# Sample
+samples = tmg(n, mu, M, initial, f, g, burn_in=burn_in)
+```
+
+
+
+
+
+## Acknowledment
+
+The `HMC` method for MCMC is based on the R package [tmg](https://cran.r-project.org/web/packages/tmg/index.html).
+
+
+
+## License
+
+[MIT](https://choosealicense.com/licenses/mit/)
+
+
+
+
+%package help
+Summary: Development documents and examples for Constrained-GaussianProcess
+Provides: python3-Constrained-GaussianProcess-doc
+%description help
+# Constrained_GaussianProcess
+
+Constrained_GaussianProcess is able to deal with linear inequality constraints in Gaussian Process frameworks. Check out the paper [Finite-Dimensional Gaussian Approximation with Linear Inequality Constraints](https://epubs.siam.org/doi/pdf/10.1137/17M1153157) for a detail explanation.
+
+![A toy example](https://github.com/liaowangh/LeetCode/raw/master/HMC.png)
+
+There are also [Hamiltonian Monte Carlo](https://arxiv.org/abs/1208.4118) method and Gibbs sampling method to sample from truncated multivariate Gaussian.
+
+
+
+## Requirement
+
+The code requires [Python 3.7](https://www.python.org/downloads/release/python-373/) , as well as the following python libraries:
+
+- [cvxpy](https://www.cvxpy.org/#)==1.0.25
+- numpy==1.17.3
+- scipy==1.2.1
+
+Those modules can be installed using: `pip install numpy scipy cvxpy` or `pip install -r requirements.txt`.
+
+
+
+## Installation
+
+Use the package manager [pip](https://pip.pypa.io/en/stable/) to install Constrained_GaussianProcess.
+
+```bash
+pip install Constrained-GaussianProcess
+```
+
+
+
+## Usage
+
+
+
+```python
+from Constrained_GaussianProcess import ConstrainedGP
+m=30
+# specify the constraints
+constraints={'increasing': True, 'bounded': [0,1], 'convex': False}
+interval=[0,1]
+Gp = ConstrainedGP(m, constraints=constraints, interval=interval)
+
+# Training data
+x_train = np.array([0.25, 0.5, 0.75])
+y_train = norm().cdf((x-0.5)/0.2)
+
+# the MCMC methods are used to approximate the posterior distribution,
+# so apart from training data, 'method' ('HMC' or 'Gibbs'), required number of samples
+# 'n' and the burn in numbers 'burn_in' should be specified when fitting the data.
+Gp.fit_gp(x_train, y_train, n=100, burn_in=100, method='HMC')
+
+x_test = np.arange(0, 1 + 0.01, 0.5)
+y_pred = Gp.mean(x_test) # get the conditional mean
+```
+
+Sampling from <img src="https://render.githubusercontent.com/render/math?math=X\sim \mathcal{N}(\mu, \Sigma)"> with constraints ![f\cdot X+g\ge 0](https://render.githubusercontent.com/render/math?math=f%5Ccdot%20X%2Bg%5Cge%200)
+
+```python
+from Constrained_GaussianProcess import tmg
+
+# set the number of samples and number in burn in phase
+n = 150
+burn_in = 30
+
+#Define the covariance matrix and mean vector
+M = np.array([[0.5, -0.4], [-0.4, 0.5]])
+mu = np.array([0,0])
+
+# Set initial point for the Markov chain
+initial = np.array([4,1])
+
+# Define two linear constraints
+f = np.array([[1,1],[1,0]])
+g = np.array([0,0])
+
+# Sample
+samples = tmg(n, mu, M, initial, f, g, burn_in=burn_in)
+```
+
+
+
+
+
+## Acknowledment
+
+The `HMC` method for MCMC is based on the R package [tmg](https://cran.r-project.org/web/packages/tmg/index.html).
+
+
+
+## License
+
+[MIT](https://choosealicense.com/licenses/mit/)
+
+
+
+
+%prep
+%autosetup -n Constrained_GaussianProcess-0.1.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-Constrained-GaussianProcess -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.1-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..765d2e6
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+b121093b39c32971130147f8b54b7984 Constrained_GaussianProcess-0.1.1.tar.gz