Calculate feature importance gain on testset

In xgboost, we use get_score to get feature importance based on training set.
Is there any way to calculate the gain on testset or any other data set?
For example, when I train a model on trainset, the importance gain for f0 is 0.002, it means when it’s split in one node, the average loss decrease by 0.002. When the model is fixed, I want to know how much the loss decrease when I use f0 to split at the same position on the testset.