# How to convert classification features into a ranking function?

I am using 3 features (x1, x2, x3) for binary classification. All my feature values are in 0 to 1 range (unit range).

I obtained how important each feature was in classification as follows (i.e. feature importance)

x1 --> 0.1
x2 --> 0.5
x3 --> 0.7


It is clear that feature 3 (x3) contributes the most, x2 the second and x1 the least in classification.

I also performed correlation analysis to check if my features are positively or negatively correlated with the target (y) as follows.

x1 --> positively correlated
x2 --> positively correlated
x3 --> negatively correlated


I am wondering if it is possible to convert my classification features into a ranking function using feature importance and correlation.

For instance, my suggestion looks as follows.

ranking_score = 0.1*x1 + 0.5*x2 + 0.7*(1/x3)


The reason for using (1/x3) in the above equation is because it is negatively correlated with the target (y). Please let me know if my ranking_score equation is statistically correct? If not, please let me know your suggestions.

EDIT: Why ranking is important to me?

My features are related to employee details (x1, x2, x3). At first I used these 3 features to classify efficient and 'inefficient' employees. Now, I want to rank the efficient employees based on these 3 features. The above equation I proposed is to facilitate this task.

I am happy to provide more details if needed.

• What is the purpose of creating this ranking score? What are you planning to rank and what is the ranking meant to represent/measure? May 13, 2019 at 5:22
• @AlexK Thank you for the comment. I edited my question based on your questions. Please let me know your thoughts on my equation. I look forward to hearing from you. Thank you very much :)
– EmJ
May 13, 2019 at 5:32

There is a lot of other questions/issues here: what model did you estimate? did your model accurately classify everyone? did you perform feature scaling/standardization before estimating the model? what kind of feature importance did you estimate (or just what package/commands did you use), as there is more than one way to get feature importance? Also, you are treating feature importances as marginal effects (like coefficients/betas in a linear regression) and that's not what they are. And you are assuming a linear/additive function of the effect of these features on efficiency, and classification algorithms don't assume/model that kind of relationship. And taking inverse values of a feature will change the relationship with the dependent variable entirely. If the goal is just to change the sign of correlation, values should just be multiplied by -1. So this overall is just not a sensible approach in my opinion.

Instead, I would recommend that you simply compute probabilities of being classified as efficient for everyone (using that same algorithm that you used to perform classification) and rank individuals by their estimated probability.

• Thanks a lot for the great answer. Did you mean something like predict_proba stats.stackexchange.com/questions/329857/… to measure the probability? Looking forward to hearing from you. Thank you very much :)
– EmJ
May 13, 2019 at 6:26
• @Emi, right, that's what I had in mind. May 13, 2019 at 6:30
• Thanks a lot for your interesting suggestion. One last question. if i get same probability for say like 10 employees. Is there a way to further give them a rank without giving all of them the same rank? I look forward to hearing from you. Thank you very much once again :)
– EmJ
May 13, 2019 at 6:42
• That will mean that they have exact same values for all three features and the response variable. One way or another, given only this data and model, I don't think you'll be able to do anything more about that. So you would need to think about re-specifying your model (adding other features, transforming some of the features if it makes sense, or running a different type of classification model). May 13, 2019 at 6:56
• That method can be applied to any dataset you specify and it should not matter whether you apply it separately to train and test data or all at once on a combined dataset. This is more of a programming question. I recommend that you post it on stackoverflow.com if you need additional guidance. May 28, 2019 at 7:31