You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Only dataframe object is supported for the "fit" method
xgbse_model = XGBSEKaplanTree(PARAMS_TREE)
# X = xgb.DMatrix(X, enable_categorical=True)
xgbse_model.fit(X, y)
but enable_categorical is not set "True" in the source code of xgbse
it gives error :
"ValueError: DataFrame.dtypes for data must be int, float, bool or category. When
categorical type is supplied, DMatrix parameter enable_categorical must
be set to True"
def build_xgb_cox_dmatrix(X, T, E):
"""Builds a XGB DMatrix using specified Data Frame of features (X)
arrays of times (T) and censors/events (E).
Args:
X ([pd.DataFrame, np.array]): Data Frame to be converted to XGBDMatrix format.
T ([np.array, pd.Series]): Array of times.
E ([np.array, pd.Series]): Array of censors(False) / events(True).
Returns:
(DMatrix): A XGB DMatrix is returned including features and target.
"""
target = np.where(E, T, -T)
return xgb.DMatrix(X, label=target)
The last line here does not set "enable_categorical = True". Category features are not supported? Or I just need to change the code here myself.
The text was updated successfully, but these errors were encountered:
It's a little more complicated because there are other instances of xgb.DMatrix being called by the estimators. I'm working on finding and changing them for a pull request, but for now I would recommend using pandas.get_dummies to convert categorical columns to one-hot encoding.
Only dataframe object is supported for the "fit" method
but enable_categorical is not set "True" in the source code of xgbse
it gives error :
"ValueError: DataFrame.dtypes for data must be int, float, bool or category. When
categorical type is supplied, DMatrix parameter
enable_categorical
mustbe set to
True
"The last line here does not set "enable_categorical = True". Category features are not supported? Or I just need to change the code here myself.
The text was updated successfully, but these errors were encountered: