# How to make the feature comparable for different instances?

I would like to use xgboost to predict stock movement by using technical indicators as features. The first feature is 'rate of price change'. It does not rely on the magnitude of price, and therefore it is comparable for different stocks.

However, the second feature depends on the magnitude of price or trade volume, e.g., 'rate of price change' multiplied by 'trade volume'. Different stocks have different range of trade volume, thus this feature is not comparable for different stocks in the magnitude.

Because different stocks may have a bit common rules for their price movements, we use only one xgboost model to train and predict on all the stocks. But the second feature has different magnitudes for different stocks, which may make it hard to use one model to find common rules for different stocks.

Moreover, it is also meaningless to simply combine the second feature from all stocks to generate a new feature because of different magnitudes.

• I don't understand why a difference in magnitude would matter in a predictive model and think you should question that assumption. In addition, somewhere in the reading I've done about xgboost there is the (possibly incorrect) assumption that it is a scale invariant method, something else worth looking into. That said, transformations such as the natural log turn features of differing scales into directly comparable and scale invariant predictors.
– user234562
Dec 15, 2020 at 14:20
• Strictly mathematically, you could try some transformation like Box-Cox-type transformations of features (like @user332577 said) which could decrease heteroskedascitiy (although I don't see much use here), or better in this case, index the volumes from 0 to 100, where 100 is the maximum observed for each stock. (Whether or not a certain indicator is informative for stock price prediction - which, if the no-arbitrage theory holds, should not be possible to an accurate extent - is a different question :) ) Dec 15, 2020 at 15:47
• @user332577 thanks. If the tree models learns that 'greater than 100 trade volume' makes stock_A up, such rules are not useful for a small-cap stock_B whose trade volume currently and historically is always lower than 10. Dec 16, 2020 at 1:18
• So, you want to make everything in a predictive stock model proportionate or relative? Sorry but having written stock picking algorithms that doesn't make sense to me. My experience is that retaining the absolute or raw values of features produces predictively superior performance vis-a-vis purely relative models. If you're still concerned include both absolute and relativized (transformed) features in your algorithm and let the data tell the story.
– user234562
Dec 17, 2020 at 15:30