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

AttributeError: 'NGBClassifier' object has no attribute 'classes_' #323

Closed
SamHosico opened this issue Apr 3, 2023 · 2 comments
Closed

Comments

@SamHosico
Copy link

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:

model = NGBClassifier(n_estimators=int(params['n_estimators'])
, learning_rate=params['learning_rate']
, minibatch_frac=params['minibatch_frac']
, col_sample=params['col_sample']
, Dist=Bernoulli
, verbose=False
, random_state=42)
cv = StratifiedKFold(n_splits=10, shuffle=True, random_state=42)
score = -cross_val_score(model, X_train, y_train.ravel(), cv=cv, scoring='roc_auc_ovo_weighted', error_score='raise').mean()### ###

@ryan-wolbeck
Copy link
Collaborator

ryan-wolbeck commented Apr 7, 2023

Can you include what version you are using and provide a full example code with imports and loading a sample data like the Boston data?

@SamHosico
Copy link
Author

Can you include what version you are using and provide a full example code with imports and loading a sample data like the Boston data?
Thanks for your reply! I have rewritten a function to replace cross validation in sklearn using the 'roc_auc' to train my model, I have achieved the expected results.

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

2 participants