Predictive Hacks

Predict Basketball Games with Log5 formula

predict nba

We have provided an example of how to get started with predictive models for NBA Games. In this post, we will show how you can get a rough estimate of the final outcome of the game by using the Log5 formula and the Beta Distribution. For this example, we will consider the game, Dallas Mavericks (away) vs Portland Trail Blazers (home).

Predictions with the Log5 Formula

The Log5 formula returns the probability that Team A will win the game against Team B based on teams’ win rate. The Log5 formula is:

\(P_{A>B}=\frac{P_A-P_A \times P_B}{P_A+P_B-2 \times P_A \times P_B}\)

A few notable properties exist:

  • If  PA=1, Log5 will always give A a 100% chance of victory.
  • If PA=0, Log5 will always give A a 0% chance of victory.
  • If PA=PB, Log5 will always return a 50% chance of victory for either team.
  • If PA=0.5, Log5 will give A a 1-PB probability of victory.

In order to calculate the probabilities using the Log5 formula, we need to take into consideration the home and the away. A good approach is to take the following weights:

  • 60% by taking into account the Home and Away Win Rate
  • 30% by taking into account the Overall Win Rate
  • 10% by taking into account the Last 10 Games Win Rate

Let’s get these Win Rates:

  • Portland Home = 14-7 (66.6%); Dallas Away = 10-10 (50%)
  • Portland Total = 25-21 (61%); Dallas Total = 21-19(52.5%)
  • Portland Streak = 7-3 (70%); Dallas Streak = 6-4 (40%)

Now we are ready to calculate the Probability of Portland defeating Dallas




log5<-function(home, away) {

prob<-0.6*log5(Por_Home,Dal_Away) + 0.3*log5(Por_Total,Dal_Total) + 0.1*log5(Por_Streak,Dal_Streak)


[1] 0.6365786

So, according to our logic the weighted Log5 the probability of Portland to Win the game is 63.65%.

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

2 thoughts on “Predict Basketball Games with Log5 formula”

Leave a Comment

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore


Image Captioning with HuggingFace

Image captioning with AI is a fascinating application of artificial intelligence (AI) that involves generating textual descriptions for images automatically.


Intro to Chatbots with HuggingFace

In this tutorial, we will show you how to use the Transformers library from HuggingFace to build chatbot pipelines. Let’s