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

'NGBClassifier' object has no attribute 'classes_' #350

Open
SamHosico opened this issue Mar 1, 2024 · 1 comment
Open

'NGBClassifier' object has no attribute 'classes_' #350

SamHosico opened this issue Mar 1, 2024 · 1 comment

Comments

@SamHosico
Copy link

SamHosico commented Mar 1, 2024

when I use ngboost and sklearn, ngboost return a error:
AttributeError: 'NGBClassifier' object has no attribute 'classes_'
I have checked the lightGBM, it has the 'classes_', so I dont know how can I solve this problem, I need some help.
my code is as follows:

from matplotlib import pyplot as plt
from sklearn.metrics import plot_roc_curve
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from ngboost import NGBClassifier
import numpy as np

model = NGBClassifier(n_estimators=10 # 922
, learning_rate=0.05
, natural_gradient=False
, random_state=42
, verbose=False)
data = load_breast_cancer()
X = data.data
y = data.target
y = y.astype(np.int32)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
plot_roc_curve(model.fit(X_train, y_train), X_test, y_test, name='XX', pos_label=1, linewidth=2)
plt.show()

And the versions of third-party libraries are as follows:
ngboost 0.5.1
matplotlib 3.5.3
scikit-learn 1.1.3

I'm sorry I didn't reply to your source code request at the time @ryan-wolbeck, thanks for your attention at that time

@SamHosico
Copy link
Author

The last issue is #323 AttributeError: 'NGBClassifier' object has no attribute 'classes_'

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

No branches or pull requests

1 participant