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
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