Getting Negative Predictions while using Tweedie Objective in Regression

I’m getting negative predictions when using a custom evaluation metric (custom_rmse) while using objective : “reg:tweedie”.

I’m performing a regression task which has no negative values.

To sanity check I did put both my custom_rmse as feval in xgb.train api and also passed “rmse” as a eval_metric in xgb.train parameters.
When I use objective : “reg:squarederror” both rmse and custom_rmse comes same, but when I use the “reg:tweedie” they both differ vastly. The inbuild rmse works fine in both cases but my custom evalution metric give some nonsense rmse.

Digging in deep I checked the predictions that my custom metric was getting and found that all the predictions were negative.

What could be the possible issue here?

Example on how the predictions vary when using squared error and tweedie objective :

This is expected as when you use reg:tweedie the loss function that you will use is the tweedie-nloglik.

Then, the prediction value is calculated by exp(link)/2 which is always positive.