I am trying to come up with an equation for a quality metric based on 3 attributes:
- Defect-proneness (Scored as a decimal between 0 and 1 -> lower value is better)
- Maintainability (Scored as a decimal between 0 and 1 -> higher value is better)
- Debt ratio (Scored as a decimal between 0 and infinity -> lower value is better)
I would like to score quality as a decimal between 0 and 1 (higher value is better). Currently, I have the following formula which scores quality as described, but using only the first 2 attributes:
Quality = ((1 - defect-proneness) + maintainability) / 2
How can I incorporate the debt ratio attribute into my equation (or similar) to produce the desired outcome?
Note: The equation does not necessarily have to produce a value between 0 and 1. A range of 0-100 for example would be sufficient.
That really depends on how (and how much) you want to penalize (the lack of) each attribute. In your example you considered a linear (convex) combination with equal weights ($1/2$), but you could have chosen
Quality = 0.1*(1 - defect-proneness) + 0.9*maintainabilityas well, if you consider maintainability (9 times) more important than lack of defect proneness.
If you want to stick to simple convex combinations, then it suffices to pick three numbers $p_1,p_2,p_3\geq 0$ such that $p_1+p_2+p_3=1$ and define
Quality$ = p_1(1 - $defect_proneness$) + p_2$maintainability$ + p_3(1-$debt_ratio$)$Equal weights amount to choosing $p_1=p_2=p_3=1/3$.
Note that convex combination are only one possibility, as nothing prevents you from considering powers (or other functions) of the attributes. Then again, it all depends on how and how much you want to penalize things. For instance, in your example something that has
defect-proneness=1butmaintainability=1would haveQuality=0.5, the same as something withdefect-proneness=0.1butmaintainability=0.1. Probably you might consider penalizing more attributes too close to extrema (too close to 0 or to 1), e.g. inserting something like $($maintainability$+\varepsilon)^{-1}$ for some $\varepsilon>0$ and then suitably normalizing to have the result in the wanted range.