## Improving the Temperature Metric

In the book Codermetrics, I introduced a metric called Temperature to measure how ‘hot’ or ‘cold’ a coder is at any given time, which might be useful to know when you are planning new work or analyzing team performance. This is an idea borrowed from Bill James who introduced the idea of Temperature as a metric for measuring hot and cold streaks in baseball (you can read an overview of the baseball version here or watch a video of Bill James explaining it here). The formula that I used in the book sets the starting Temperature for any developer at 72 degrees (“room temperature” also borrowed from Bill James), and then moves the Temperature up or down based on the percentage improvement in “Points” accumulated by the individual in each development iteration. So the formula looks like:

Current Temperature = Previous Temperature * (Points in The Most Recent Iteration / Points in The Prior Iteration)

A reader, Alex Mera, recently pointed out that this formula is flawed in that it is entirely relative to each individual and that significant differences in early iterations make Temperature ratings difficult to compare. As Alex correctly stated, for example, “scoring low on the first iteration will raise your temperature on every subsequent iteration.” While the formula can show you the trend for each developer, two people performing similarly might have two very different Temperatures (based on the results of much earlier performance) and two people with the same Temperature might actually have very different recent performance.

Take for example two people, Coder A and Coder B, who have the following Points over twelve development iterations (you can assume for this example that Points are assigned to a completed task based on the complexity of each task):

In the example data, the Points per iteration are not that different except in a few places. In the first and second iteration, each coder has one iteration where the Points are 16, for Coder A it’s the first iteration and for Coder B it’s the second. The other noticeable difference is a rise in Coder B’s Points in later iterations.

If you use the Temperature metric as calculated in the book for this data, then the results look like this:

Although the Points were similar, the Temperatures are very different. This is because the “baseline” for each coder’s “room temperature” is the number of Points in their first iteration, which for Coder A was much lower than Coder B, resulting in much higher Temperatures overall for Coder A. In later iterations, when Coder B is clearly “hotter” than Coder A, Coder B’s Temperature is still lower. You can see the trends, and you could say that both Coder A and Coder B are “hot” when their Temperatures are for example above 90 degrees, but the difference highlights the kind of problem that Alex noted.

So what can you do to change and improve this? One technique would be to set the baseline “room temperature” in a different way. For example, if you knew that 24 Points was the average for a developer in each iteration, you could use 24 Points as room temperature, and compare the Points in every iteration to that. You might get this baseline by taking the average for all the individuals on the team (maybe just for recent iterations or maybe over a longer period) or you might only use the average for each individual (in other words, compare each individual to their own average). While there are a number of variations you could use, each with different benefits, the general approach can be described with the following formula:

Current Temperature = Room Temperature * (Points in the Most Recent Iteration / Points for Room Temperature)

If you set room temperature to 72 and the points for room temperature to 24 for both coders, then using the example data above you get the following results:

This appears to be a much “fairer” way to calculate Temperature, and it provides a good way to compare individuals since all Temperatures are relative to the same baseline. The variance based on the differences in the initial iterations is gone. Also, using this type of approach you are better able to evaluate what 80 degrees means versus 70 degrees or 90 degrees. On the negative side, however, you’ll notice that the graph of Temperature looks pretty much exactly the same as the graph of Points above. All you’ve really done is translate Points into a different metric, which may provide a different way to analyze Points, but the Temperature rises and dips exactly as the Points do.

So another improvement to consider would be to look at a group of recent iterations together, as opposed to one at a time. Since Temperature is meant to measure “hot” and “cold” it makes sense that it should focus on trends and not just on one period. To do this, you can use moving averages, which would modify the formula to the following:

Current Temperature = Room Temperature * (Moving Average of Points in Recent Iterations / Points for Room Temperature)

If you set room temperature to 72 and the points for room temperature to 24, and then you calculate the moving average over the three most recent iterations at every point, your results will look like this:

This approach, using a common baseline for room temperature, and making use of moving averages, probably gives you the best result and the best response to Alex’s concern. Temperature is more comparable this way, and less subject to isolated bursts or dips.

Other improvements that could be considered:

- Rather than just using Points, calculate Temperature from a combination of other metrics, taking into account other positive contributions (like helping others) to increase an individual’s Temperature and negative outcomes (like attributable production bugs) to decrease Temperature; this, however, would require a more complex formula for increasing and decreasing Temperature, so while I think this idea has merit due to the increased complexity I decided not to delve into the details in the book or here (I may do that at a later time but my main interest so far has been to share the idea of Temperature and “hot” and “cold” streaks for software engineers)
- Rather than only calculating the moving average of recent iterations, you could have multiple moving averages with different weights; for example, you could take the moving average of the three most recent iterations and weight that as 75% and then take the moving average of the three prior iterations and weight that as 25%, giving you a longer trend to feed into the Temperature formula

For what it’s worth, all of the possible improvements mentioned in this article are in line with the techniques used by Bill James in his baseball Temperature metric. Other, more detailed tweaks could be identified, too. But as usual I suggest starting with a simple approach that’s understandable and explainable for you and your team, knowing that you can add more complex metrics later.

## Enter a Comment