Skip to main content

Regularized GLM models running on a GPU.

Project description

gpu_glm

A lightweight Python implementation of Generalized Linear Models (GLMs) that runs on a GPU.

This package provides:

  • Gaussian, Bernoulli, Poisson, Gamma, and Inverse Gaussian models.
  • Multiple link functions (identity, log, inverse, logit, probit, etc.)
  • A Cupy-based implementation that falls back to Numpy.
  • A sci-kit learn interface.
  • L2 regularization.

Installation

To use the GPU, cupy must be installed with a GPU dependancies already working. If cupy is unavailable, numpy is used.

pip install gpu-glm

A conda package to handle GPU dependancies is under development.

Quick Example

Below fits a linear regression model.

import numpy as np
from gpu_glm import gaussian_glm
from sklearn.metrics import root_mean_squared_error

# Simulated data
X = np.column_stack([np.random.randn(100), np.ones(100)])
y = 2 * X[:, 0] + 3 +  np.random.randn(100)

# Fit model
model = gaussian_glm()
model.fit(X, y)
print(f"coefficients: {model.coef()}")

y_hat = model.predict(X)
rmse = root_mean_squared_error(y, y_hat)
print(f"RMSE: {np.round(rmse, 3)}")

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

gpu_glm-0.1.2.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

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

gpu_glm-0.1.2-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file gpu_glm-0.1.2.tar.gz.

File metadata

  • Download URL: gpu_glm-0.1.2.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gpu_glm-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b5ddabd981a0d78e9d4c1c6f711fb97036366bed11eb268e6bae689b5eac2d30
MD5 272c37316d6ec47ff1902f27ecb558ac
BLAKE2b-256 6fad105f5abe4b75e9bccb4699cedc204303b74cabfce2cf40b9cde9a9f46759

See more details on using hashes here.

Provenance

The following attestation bundles were made for gpu_glm-0.1.2.tar.gz:

Publisher: publish_pypi.yml on gmcmacran/gpu_glm

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

File details

Details for the file gpu_glm-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: gpu_glm-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gpu_glm-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4c6364fdf76a629584c4a8b8d0b31729d0761f51c18a327b9cff47437126d7f6
MD5 041b64945ec247ff58b5590b19072296
BLAKE2b-256 ad55e2f889dc052a6a8bacffb1145e5d94506558f1f3efece00ba8013ce63a38

See more details on using hashes here.

Provenance

The following attestation bundles were made for gpu_glm-0.1.2-py3-none-any.whl:

Publisher: publish_pypi.yml on gmcmacran/gpu_glm

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