This is going to be extremely hard. A weight rating that compares a horses best 3 recent runs over similar conditions to include distances won or lost by carrying a weight plus or minus X pounds against similar class opposition. PHEW!!! Probably better for National hunt .
I watch many races where front running or prominent horses go great guns and look winners all the way and then at a certain point of the race they empty very quickly and are quickly swamped. It happens often with favourites and horses prominent in the market too. I can often pinpoint these horses by a lot of looking back at runs over distances and on different going and in certain field sizes and, not least with jumpers, course direction. I also notice that there is a correlation when a handicapper sometimes gets it wrong and ups a horse too much or drops one too much but it is a laborious task trying to make a correlation between pounds and distance lengths that may or may not stop or help the horse. Of course it's a difficult approach but it pays dividends especially in the lay markets but it is very very time consuming just to go through one race and a predictive algorithm would be a first anywhere. Unfortunately, I am good at maths but not a statistical maths genius so it doesn't exist yet.