-
Notifications
You must be signed in to change notification settings - Fork 188
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
XGBoost conversion error: Model is empty #457
Comments
seems support for onnxmltools is no longer active. |
@xadupre your thoughts are appreciated, am aware you did the fix for v1.7 |
I assume the traning ended up producing an empty tree. I need to see how XGBoost handles that case, is the tree ignored at inference time, a quick fix is possible then, or does it happen when the problem is binary and then avoids storing class information. Can you tell if it is a binary classification? |
yes it is binary classification problem. I dont think the training ended up into an empty tree, because the same trained model is shared across two versions. Attached is a model dump. |
@xadupre Here's a code snippet along with a small data file to reproduce the issue. The issue does not occur if the best_ntree_limits ended up equal to n_estimators import pickle with open('X.sav','rb') as f: with open('y.sav','rb') as f: X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=10) clr = XGBClassifier( clr.fit(X_train, y_train, eval_set=[(X_test, y_test)], early_stopping_rounds=40) |
Signed-off-by: xavier dupré <xavier.dupre@gmail.com>
I get an error when using the latest version deployed from source code 1.8.0 to convert an XGBoost model trained using early stopping. The error does not occur on v1.7.0, however the old version has a prediction mismatch which was fixed in the latest version (due to best_ntree_limit handling). XGBoost version = 1.3.3
238 if len(attr_pairs['class_treeids']) == 0: --> 239 raise RuntimeError("XGBoost model is empty.")
Model:
XGBClassifier(base_score=0.5, booster='gbtree', colsample_bylevel=1, colsample_bynode=1, colsample_bytree=0.75, eval_metric='logloss', gamma=10, gpu_id=-1, importance_type='gain', interaction_constraints='', learning_rate=0.05, max_delta_step=0, max_depth=7, min_child_weight=50, missing=nan, monotone_constraints='()', n_estimators=1000, n_jobs=32, num_parallel_tree=1, random_state=42, reg_alpha=0, reg_lambda=0.005, scale_pos_weight=150, subsample=0.75, tree_method='hist', use_label_encoder=False, validate_parameters=1, verbosity=1)
The text was updated successfully, but these errors were encountered: