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

plot_tree for multiclass crashed #9646

Closed
aleixrvr opened this issue Oct 9, 2023 · 4 comments
Closed

plot_tree for multiclass crashed #9646

aleixrvr opened this issue Oct 9, 2023 · 4 comments

Comments

@aleixrvr
Copy link

aleixrvr commented Oct 9, 2023

I'm using the new v2.0 xgboost for multiclass regression and the function plot_tree crashes.

This is an example inspired in the documentation https://xgboost.readthedocs.io/en/stable/python/examples/multioutput_regression.html

Example

import numpy as np
import xgboost as xgb

rng = np.random.RandomState(1994)
X = np.sort(200 * rng.rand(100, 1) - 100, axis=0)
y = np.array([np.pi * np.sin(X).ravel(), np.pi * np.cos(X).ravel()]).T
y[::5, :] += 0.5 - rng.rand(20, 2)
y = y - y.min()
y = y / y.max()

reg = xgb.XGBRegressor(
    tree_method="hist",
    n_estimators=128,
    n_jobs=16,
    max_depth=8,
    multi_strategy="multi_output_tree",
    subsample=0.6,
)
reg.fit(X, y, eval_set=[(X, y)])

xgb.plot_tree(reg)
@trivialfis
Copy link
Member

It's a highly experimental feature as noted in the demo. Anything not shown in that demo can be assumed to be not yet supported.

@trivialfis
Copy link
Member

Closing in favor of #9043 .

@trivialfis
Copy link
Member

Just to clarify, xgboost works with classification since day 1. The issue here is using regression with multi_output_tree.

@aleixrvr
Copy link
Author

Ok, thanks! I will wait until it is implemented!

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