Skip to main content

CWGP

Project description

Compositionally Warped Gaussian Processes

This package is dedicated to realizing methods used in this paper.

TLDR;

A package that transforms anything to a Gaussian distribution.

Tutorial

Visit here

Quick Start

Let's randomly generate 100 numbers following an exponential distribution.

import numpy as np
import seaborn as sns

exp = np.random.exponential(scale=5, size=100)

We now instantiate a CWGP class consisting of 3 Sinh-Arcsinh transformations.

from cwgp.cwgp import CWGP

compgp = CWGP("sa", n=3)

We then fit our data into the model. This minimizes the negative log likelihood function and stores the corresponding parameters for us.

compgp.fit(exp)

To get the parameters, we do

params = compgp.phi.res.x

We then transform the data via

t_exp, d = compgp.phi.comp_phi(params, exp)
sns.distplot(t_exp)
plt.show()

Let's make a QQ-plot and see how Gaussian it is.

from scipy import stats

stats.probplot(t_exp, dist="norm", plot=plt)
plt.show()

The inverse function is also implemented.

inv_t_exp = compgp.phi.inv_comp_phi(params, t_exp)
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.

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

Kernels

Ornstein-Uhlenbeck Kernel

from cwgp.kernel import OU

Radial Basis function Kernel

from cwgp.kernel import RBF

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

CWGP-2.0.3.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

CWGP-2.0.3-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file CWGP-2.0.3.tar.gz.

File metadata

  • Download URL: CWGP-2.0.3.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.23.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.9

File hashes

Hashes for CWGP-2.0.3.tar.gz
Algorithm Hash digest
SHA256 d123e224100a8586de59c7382e211c732784b4cde03afced54b912ca5f6cb343
MD5 dc38ac3ddc2e53f3c96ba824bc392197
BLAKE2b-256 abbdec58dce90c8fcd8411a97694ec56ec2f756c8d9cbcc46f0756ef12b32b7b

See more details on using hashes here.

File details

Details for the file CWGP-2.0.3-py3-none-any.whl.

File metadata

  • Download URL: CWGP-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.23.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.9

File hashes

Hashes for CWGP-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3ff4972e8756a9d7ac2d37fda6916357a0443ca1c1dfc0f9df9aad8a0f64a80a
MD5 1b973caf3917976aaa6e53b5be2a98e3
BLAKE2b-256 6c8face1869524059d55da49f900fc2324be0997c7e1209748c7d4305b67d9c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page