The best suggestion for how to convert an AI factor into a ranking system?

What would be the best solution for converting an AI factor's feature importance using the coefficients into a ranking system?

I gave Gemini my coefficient overview, the ranking system (or factor list which is taken from a ranking system) and an explanation of how the ranking system is structured here: https://www.portfolio123.com/doc/RankingDoc.pdf

The best suggestion for how to convert an AI factor into a ranking system was: (se below)

But is it? Are there better ways to do this?

Step 1: Normalize Coefficients into Percentage Weights
Since Portfolio123 combines factors using a weighted average that must total 100%, you need to convert your raw AI coefficients into percentages.

  • Add up all the coefficients in your list to get a "Total Sum".

  • For each factor, calculate its percentage weight: (Coefficient / Total Sum) * 100.

  • Enter this resulting percentage as the "Weight" for that specific node in Portfolio123.

Step 2: Prune the "Noise" (Cut down the number of factors)
A ranking system with 100+ factors will be slow, hard to maintain, and highly prone to overfitting.

  • Keep only the top factors that make up about 75–80% of the total cumulative weight.

  • Discard the factors at the bottom of your list, as their weights are so mathematically insignificant that they won't noticeably impact the final ranking anyway.

Step 3: Define the Direction (Higher vs. Lower is Better) – Critical!
The AI feature importances only tell you how important a factor is, not which direction it points.

  • You must manually evaluate each factor you kept and assign the correct logical direction in Portfolio123.

  • For example: CF/A (Cash flow) should be set to Higher is better, while Volatility should likely be set to Lower is better.

Step 4: Set "NA Handling" to Neutral
By default, Portfolio123 severely penalizes companies with missing data (NA), pushing them to the bottom of the rank. AI models, on the other hand, usually treat missing data neutrally or assign it to an average.

I tried making an app, that could do this fore me: RS builder - p123

If you create a Linear Model with Normalization by Date and Scaling by Rank, you can convert it to a traditional P123 Ranking system. Just use the feature importance as weight for the factors.

You can not convert a tree based algo to a P123 linear ranking system

6 Likes

I’ve been curious about this as well - is it actually possible to know which direction the AI points? It may not match what makes logical sense. Or is there a default direction that the AI models use?

This is true practically due to P123 constraints, but in theory, I would argue that a tree-based ensemble (like RF or ET) can be translated into p123 ranking system (and Screener).

One could convert each individual tree into a custom Eval() formula node and then combine them inside a composite ranking node to calculate the average. This directly mirrors how RF/ET inference works.

Now when you mention it, you could go wild with custom formulas in custom formulas and just do a summation in the ranking system. Not sure what the limitations to that would be, slot counts? How deep can we nest?
Is there an API integration for custom formulas? Could be a fun test...

I did a trial, the real limitation is the maximum cross-sectional functions that can be used in one node is only 80.