You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to model an ordinal variable using an XGBoost model in R. The target has 30 classes with a natural order, but the order should not be expressed as numeric. While this can be treated as a classification problem, it does not fully capture the ordinal nature of the target.
I found some issues and solutions for implementing an ordinal objective function in Python, but I couldn't find anything similar for R. For example I found the project "OrdinalGPT" for lightgbm in Python. I attempted to implement an ordinal objective function based on the ideas from the paper "A simple log-based loss function for ordinal text classification". The idea in this paper is to use a cross-entropy loss and incorporate the order of classes using a distance matrix.
Here is the R code I tried for the custom objective function:
The function runs without errors, but during the prediction process, I am getting probabilities smaller than zero, and the model's accuracy is poor.
Do you have any idea why this objective function is not working as expected, or can you suggest a better way to implement an ordinal loss function in R?
The text was updated successfully, but these errors were encountered:
I am trying to model an ordinal variable using an XGBoost model in R. The target has 30 classes with a natural order, but the order should not be expressed as numeric. While this can be treated as a classification problem, it does not fully capture the ordinal nature of the target.
I found some issues and solutions for implementing an ordinal objective function in Python, but I couldn't find anything similar for R. For example I found the project "OrdinalGPT" for lightgbm in Python. I attempted to implement an ordinal objective function based on the ideas from the paper "A simple log-based loss function for ordinal text classification". The idea in this paper is to use a cross-entropy loss and incorporate the order of classes using a distance matrix.
Here is the R code I tried for the custom objective function:
The function runs without errors, but during the prediction process, I am getting probabilities smaller than zero, and the model's accuracy is poor.
Do you have any idea why this objective function is not working as expected, or can you suggest a better way to implement an ordinal loss function in R?
The text was updated successfully, but these errors were encountered: