You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add Simple End-to-End Example for Regression Using pyGAM #541
pyGAM is a powerful library for building Generalized Additive Models (GAMs) in Python, designed with a familiar API for users of scikit-learn and SciPy.
However, new users often struggle to create their first working model due to a lack of a minimal end-to-end example covering data generation, model fitting, and prediction.
This issue proposes adding a beginner-friendly example script demonstrating regression with pyGAM.
Objective
Create a simple example that demonstrates:
Generating or loading sample data
Training a GAM regression model
Making predictions
Visualizing results
Running successfully with minimal setup
Why This Matters
✨ Improves onboarding for new users
✨ Helps users coming from scikit-learn ecosystem
✨ Demonstrates core functionality quickly
✨ Reduces repetitive support questions
✨ Encourages adoption in research & industry
Proposed Changes
Add a new example file: examples/basic_gam_regression.py
Example Implementation (Starter Code)
"""
Basic Regression Example using pyGAM
"""
import numpy as np
import matplotlib.pyplot as plt
from pygam import LinearGAM, s
Generate synthetic nonlinear data
np.random.seed(0)
X = np.linspace(0, 5, 100)
y = np.sin(X) + np.random.normal(scale=0.2, size=100)
erify the example runs on the latest pyGAM version (≥ 0.12.0)
Add clear comments explaining each step
Place file in the examples directory
(Optional) Link example in README or docs
Acceptance Criteria
✔ Script runs without errors
✔ Uses only public pyGAM APIs
✔ Beginner-friendly comments included
✔ Demonstrates full workflow (data → model → prediction → plot)
✔ Added to examples folder
✔ Compatible with current release
Activity
ayushk687 commentedon Mar 17, 2026
@jonathan-taylor please assign this issue to me