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
I want fit and transform over a Tensor of categoricals to behave like fitting each categorical.
import matplotlib.pyplot as plt
import numpy as np
from generalized_additive_models import GAM, Categorical, Spline, Tensor
from generalized_additive_models.datasets import load_powerlifters
# Load data and filter it
df = load_powerlifters().rename(columns=lambda s:s.removeprefix("best3").removesuffix("kg"))
# Melt dataframe so each exercise (squat, bench, deadlift) ends up in a row
df = df.melt(id_vars=["sex", "age", "bodyweight"], value_vars=["squat", "bench", "deadlift"], value_name="lifted", var_name="exercise")
# Predict total weight lifted, given age, bodyweight and sex
target = df["lifted"]
age = Spline("age", penalty=1e3, num_splines=8)
bodyweight = Spline("bodyweightkg", penalty=1e3, num_splines=8)
I want fit and transform over a Tensor of categoricals to behave like fitting each categorical.
However:
The text was updated successfully, but these errors were encountered: