Skip to main content

No project description provided

Project description

kolesky

Python code for the paper Sparse Cholesky Factorization by Kullback-Leibler Minimization

Gaussian process (GP) regression can be approximated in two ways: a faster prediction points first and a more accurate prediction points last. Both methods accept the same hyperparameters: rho, lambda, and p for tuning accuracy. In general, the main parameter to tune is rho and accuracy will increase as rho increases until we reach the exact GP regression.

We will start by generating a synthetic dataset. The true equation is $f(x) = x\sin(x)$

import numpy as np

x_train = np.random.uniform(-5, 5, 15).reshape(-1, 1)
x_test = np.linspace(-5, 5, 50).reshape(-1, 1)
y_train = x_train * np.sin(x_train)

To fit a Gaussian process on this data, we choose to use an RBF kernel function for our covariance. We also choose rho = 10, lambda = 1.5, and p = 1.

import kolesky.gp_regresssion as kgp
import sklearn.gaussian_process.kernels as kernels

kernel = kernels.RBF(length_scale=1.0)
mu, var = gp.estimate(x_train, y_train.flatten(), x_test, kernel, 10.0, 1.5, p=1)

After fitting our model, we can create the following plot:

import matplotlib.pyplot as plt
plt.figure(figsize=(10, 5))
plt.plot(x_train[:, 0], y_train.flatten(), 'ro', label='Training Data')
plt.plot(x_test[:, 0], mu, 'b-', label='Predicted Mean')
plt.plot(x_test[:, 0], x_test[:, 0] * np.sin(x_test[:, 0]), 'g--', label='Unnoisy Function')
plt.fill_between(x_test[:, 0], mu - 1.96 * np.sqrt(var), mu + 1.96 * np.sqrt(var), color='lightblue', alpha=0.5, label='95% Confidence Interval')
plt.title('Gaussian Process Regression with Sparse Cholesky')
plt.xlabel('Input')
plt.ylabel('Output')
plt.legend()
plt.show()

GP Regression using Sparse Cholesky

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

kolesky-0.1.4a1.tar.gz (856.8 kB view details)

Uploaded Source

Built Distributions

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

kolesky-0.1.4a1-cp313-cp313-manylinux_2_28_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

kolesky-0.1.4a1-cp312-cp312-manylinux_2_28_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

kolesky-0.1.4a1-cp311-cp311-manylinux_2_28_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

kolesky-0.1.4a1-cp310-cp310-manylinux_2_28_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

File details

Details for the file kolesky-0.1.4a1.tar.gz.

File metadata

  • Download URL: kolesky-0.1.4a1.tar.gz
  • Upload date:
  • Size: 856.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kolesky-0.1.4a1.tar.gz
Algorithm Hash digest
SHA256 df7acce3cc5e3020a193056728d581584dc33c1a4f0b6c4cbc44ba3863f9a2db
MD5 9d7bc1381e27dd613d104d22b2a0e609
BLAKE2b-256 a86fdfc3d4fabecdf97e0d974731f84da303dd30278ea8adccb92d8c26457cfe

See more details on using hashes here.

Provenance

The following attestation bundles were made for kolesky-0.1.4a1.tar.gz:

Publisher: build-wheels.yml on raymond-zeng/kolesky

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kolesky-0.1.4a1-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kolesky-0.1.4a1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 12e0c519702a4eb36923e5fe9c841ead4e0c7dc04b1b5e84e5364b941b79b5ec
MD5 381ae3b6b55b91ff1ab3ee0e81a6daeb
BLAKE2b-256 9621e0ca01a83349677ca87da83d0be008a3f37097297ddd17af2f8dbb4fb717

See more details on using hashes here.

Provenance

The following attestation bundles were made for kolesky-0.1.4a1-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on raymond-zeng/kolesky

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kolesky-0.1.4a1-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kolesky-0.1.4a1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fda31b1e3ae098668671e329a94fadd7a8326b0e7b881f9661849ddf2280519f
MD5 3ad87ab45781e4c811a9d58db7bf5709
BLAKE2b-256 f3c7cde67c06f76358037930b23212476a283c6520765a019ae10f5b5eac1b53

See more details on using hashes here.

Provenance

The following attestation bundles were made for kolesky-0.1.4a1-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on raymond-zeng/kolesky

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kolesky-0.1.4a1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kolesky-0.1.4a1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b44d077af40fed391ef0dd620d2bd20e2f7d8aab123dcba7bf31e84b1a7ff245
MD5 9065aef0df53af9306d7854cad0ba5c5
BLAKE2b-256 9ea8cc5c3fbb0ba7712003393a71871055aee6068101548fcd053743a2c38e70

See more details on using hashes here.

Provenance

The following attestation bundles were made for kolesky-0.1.4a1-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on raymond-zeng/kolesky

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kolesky-0.1.4a1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kolesky-0.1.4a1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7c38e201ae4aa7d9f54fde4da85c3f0b4d432f81d823cb361a11ca7db4f486e9
MD5 88677bb0954477c4df06272e5b40efc4
BLAKE2b-256 06a5e2ffb2ffe6ad9a5add189aeb50ae4d5f1098ca7958485854f6dbbf961404

See more details on using hashes here.

Provenance

The following attestation bundles were made for kolesky-0.1.4a1-cp310-cp310-manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on raymond-zeng/kolesky

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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