Custom Python Model XGBoost Training Error

Options
Brenna
Brenna Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Registered Posts: 3 ✭✭✭

Hello,

I trained a Custom Python model with the XGBoost code sample using the built-in env but got an error, "Coefficients are not defined for Booster type gbtree". Please find details in the attached images.

Do I need to install any package or update anything?

Thanks!

Capture1.PNG

Capture2.PNG


Operating system used: Windows 10

  

Answers

  • AlexandreL
    AlexandreL Dataiker Posts: 36 Dataiker
    Options

    Hi,

    This is indeed a bug that is planned to be fixed in the next DSS version. In the meantime, you can use this code sample as a workaround

    from sklearn.base import BaseEstimatorimport xgboost as xgbclass DSSXGBRegressor(BaseEstimator):def __init__(self, **kwargs):self.clf = xgb.XGBRegressor(**kwargs)def fit(self, X, y):self.clf.fit(X,y)def predict(self, X):return self.clf.predict(X)def get_params(self, deep=False):return self.clf.get_params(deep)clf = DSSXGBRegressor(booster='gblinear', gamma=0, max_depth=6, min_child_weight=1)
  • Brenna
    Brenna Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Registered Posts: 3 ✭✭✭
    Options

    Hi Alex,

    Thank you for your answer. I copied and pasted your code sample but got a PicklingError:

    PicklingError: Can't pickle <class 'DSSXGBRegressor'>: it's not found as __builtin__.DSSXGBRegressor

    Best,

    Boren

Setup Info
    Tags
      Help me…