Skip to main content

Fastgam

Fastgam is a Python package for constructing fast additive models.

Installation

You can install the package via pip:

pip install fastgam

Minimal example

In this example, we try to learn an additive model with $d = 5$ effects, with a regularity $s = 2$. The data satisfies

  • $Y = f(X_1, \dots, X_5) + \varepsilon$,
  • $f(x_1, \dots, x_5) = \sum_{j=1}^5 (\exp(x_j/(j+1))-1)$,
  • $\varepsilon \sim \mathcal N(0, 1)$.
import numpy as np
from fastgam import FastGAM

d = 5
s = 2
N = 10**2
N_val = 1000

lambda_N_list = [10**(-i/3) for i in range(10)]

x_train = np.random.uniform(size=(d, N))
f_train = np.zeros(N)
for i in range(d):
    f_train += np.exp(x_train[i]/(i+1)) - 1
y_train =  (f_train + np.random.normal(size=N)).astype(np.complex128)

x_val = np.random.uniform(size=(d, N_val))
f_val = np.zeros(N_val)
for i in range(d):
    f_val += np.exp(x_val[i]/(i+1)) - 1
y_val =  (f_val + np.random.normal(size=N_val)).astype(np.complex128)


lambda_n=N**(-(2*s)/(2*s+1))
m = 1+ int(N**(1/(2*s+1))/d)
threshold = lambda_n/10

model = FastGAM(d)
model.fit_grid(x_train, y_train, x_val, y_val,lambda_N_list, m, threshold)

N_test = 10**4
x_test = np.random.uniform(size=(d, N_test))
f_test = np.zeros(N_test)

for i in range(d):
    f_test += np.exp(x_test[i]/(i+1)) - 1
y_test =  f_test.astype(np.complex128)

model.predict(x_test)
model.mse(y_test)

Metadata

Release files for fastgam 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastgam 1.0.2
File Size Uploaded Provenance Actions
fastgam-1.0.2.tar.gz 4.6 kB With provenance Details for fastgam-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fastgam 1.0.2
File Interpreter ABI Platform Actions
fastgam-1.0.2-py3-none-any.whl Python 3 none any Details for fastgam-1.0.2-py3-none-any.whl

Total release size: 9.7 kB

Release files / fastgam-1.0.2.tar.gz

Download URL fastgam-1.0.2.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2583fbbdb87bf3e4efa45b6b93bd8decf85f1e55907cba4ab52db45f65d3eb51
BLAKE2b-256 checksum
How to use checksums
a90f96eea77b83d64ed8000bf0a53f8559d6ba83b6d71923fbba6676fe8bc149
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2025.

Transparency log

Release files / fastgam-1.0.2-py3-none-any.whl

Download URL fastgam-1.0.2-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16aae27c7360be8847cf55e65b074316f4fd266ac9f1b591ead2a22cd5c9100c
BLAKE2b-256 checksum
How to use checksums
1ed16451ae54a91a3ffa0a611a0de8144bb5edaae72f7538b2158928e6c9f40d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2025.

Transparency log

Security for fastgam 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fastgam-1.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page