uv run --with "xgboost==3.1.2" --with "scikit-learn==1.8.0" python -c "import xgboost as xgb; import numpy as np; clf = xgb.XGBClassifier(); clf.fit(np.array([[1,2],[3,4]]), np.array([0,1])); clf.save_model('/tmp/m.json')"
Traceback (most recent call last):
File "<string>", line 1, in <module>
import xgboost as xgb; import numpy as np; clf = xgb.XGBClassifier(); clf.fit(np.array([[1,2],[3,4]]), np.array([0,1])); clf.save_model('/tmp/m.json')
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/Users/user/Library/Caches/uv/archive-v0/sXGU8q25SWHdmrhHwIVGT/lib/python3.13/site-packages/xgboost/sklearn.py", line 1113, in save_model
meta["_estimator_type"] = self._get_type()
~~~~~~~~~~~~~~^^
File "/Users/user/Library/Caches/uv/archive-v0/sXGU8q25SWHdmrhHwIVGT/lib/python3.13/site-packages/xgboost/sklearn.py", line 1104, in _get_type
raise TypeError(
...<2 lines>...
)
TypeError: `_estimator_type` undefined. Please use appropriate mixin to define estimator type.
Minimal repro:
Stack trace:
Verified the same code works with sklearn 1.7.*