I have trained a XGB classifier and want to convert it into onnx model. I am using skl2onnx for this and getting below error:
Unable to find a shape calculator for type '<class 'xgboost.sklearn.XGBClassifier'>'
Tried it resolving it after finding a below solution on google
update_registered_converter(
xgb, 'XGBoostXGBClassifier',
calculate_linear_classifier_output_shapes, convert_xgboost,
options={'nocl': [True, False], 'zipmap': [True, False, 'columns']})
My XGB training params are
xgb_model = xgb.XGBClassifier(
booster="gbtree", # Tree, Linear, or DART
# versbosity=1, # Verbosity of printing messages
eta=0.0635, # Learning rate
gamma=0.5, # Minimum loss reduction to make a split
min_child_weight=1,# Minimum sum of instance weight needed in a child
subsample=0.55, # Subsample ratio of the training instances
reg_lambda=3.2, # L2 regularization term on weights
alpha=1, # L1 regularization term on weights
objective="binary:logistic", # Binary classification
eval_metric=["auc", "error", "aucpr"], # Evaluation metrics for validation data
n_estimators=100, # Number of boosting rounds
max_depth=8, # Maximum tree depth
learning_rate=0.1, # Step size at each iteration
random_state=42 # Random seed for reproducibility)