Before searching for split points LightGBM sorts categories withing categorical features by:

$$\frac{\sum_{i=1}^{n} 1_{x_{i j}=x_{i k}} g_{i}}{\sum_{i=1}^{n} 1_{x_{i j}=x_{i k}} h_{i}}$$

Where $$g_i$$ is gradient, and $$h_i$$ is hessian for instance $$i$$. $$j$$ denotes categorical feature and $$k$$ denotes category.

I understand that the gradient shows the change in the loss function for one unit change in the feature value. Similarly the hessian represents the change of change, or slope of the loss function for one unit change in the feature value.

What confuses me however is how to interpret unit change for categorical variables. It does not make sense to me since they are not ordinal.