Skip to content

Commit

Permalink
support objective=gamma in lgbm regressor
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Benedikt Jagusch <jan.jagusch@gmail.com>
  • Loading branch information
janjagusch committed Jul 27, 2021
1 parent f295db6 commit d0d9f8b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion onnxmltools/convert/lightgbm/_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def __init__(self, booster):
_model_dict['objective'].startswith('multiclass')):
self.operator_name = 'LgbmClassifier'
elif (_model_dict['objective'].startswith('regression') or
_model_dict['objective'].startswith('poisson')):
_model_dict['objective'].startswith('poisson') or
_model_dict['objective'].startswith('gamma')):
self.operator_name = 'LgbmRegressor'
else:
# Other objectives are not supported.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def convert_lightgbm(scope, operator, container):
n_classes = 1 # Regressor has only one output variable
attrs['post_transform'] = 'NONE'
attrs['n_targets'] = n_classes
elif gbm_text['objective'].startswith('poisson'):
elif gbm_text['objective'].startswith('poisson') or gbm_text['objective'].startswith('gamma'):
n_classes = 1 # Regressor has only one output variable
attrs['n_targets'] = n_classes
# 'Exp' is not a supported post_transform value in the ONNX spec yet,
Expand Down

0 comments on commit d0d9f8b

Please sign in to comment.