Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GAM creates multiple knots at the same coordinates #7844

Closed
exalate-issue-sync bot opened this issue May 11, 2023 · 1 comment
Closed

GAM creates multiple knots at the same coordinates #7844

exalate-issue-sync bot opened this issue May 11, 2023 · 1 comment

Comments

@exalate-issue-sync
Copy link

When quantile-based knots generation (currently equidistant) is used together with an ordinal value of low cardinality (10-12), multiple knots (at least two) might hit he same value.

{noformat}import h2o
import numpy as np
from h2o.estimators.gam import H2OGeneralizedAdditiveEstimator
h2o.init()

load and prepare California housing dataset

np.random.seed(1234)
data = h2o.H2OFrame(
python_obj={'C1': list(np.random.randint(0, 9, size=1000)),
'target': list(np.random.randint(0, 2, size=1000))
})

use only 3 features and transform into classification problem

feature_names = ['C1']
data['target'] = data['target'].asfactor()

split into train and validation sets

train, test = data.split_frame([0.8], seed=1234)

build the GAM model

h2o_model = H2OGeneralizedAdditiveEstimator(family='binomial',
gam_columns=feature_names,
scale=[1],
num_knots=[10],
)
h2o_model.train(x=feature_names, y='target', training_frame=train){noformat}

!image (1).png|width=2068,height=1288!

Discovered by [~accountid:5f484754fe0a46004dc38d32]

@h2o-ops
Copy link
Collaborator

h2o-ops commented May 14, 2023

JIRA Issue Migration Info

Jira Issue: PUBDEV-7798
Assignee: Karthik Murthy
Reporter: Pavel Pscheidl
State: Resolved
Fix Version: 3.32.0.5
Attachments: Available (Count: 1)
Development PRs: Available

Linked PRs from JIRA

#5347
#5397

Attachments From Jira

Attachment Name: image (1).png
Attached By: Pavel Pscheidl
File Link:https://h2o-3-jira-github-migration.s3.amazonaws.com/PUBDEV-7798/image (1).png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant