averaging weighted values giving inaccurate overall view

54 Views Asked by At

I'm building a habit tracker of sorts - one that visualizes how much of your goal you accomplished based on the data you enter regarding the completion of various tasks in different categories. For the sake of simplicity, let's say that it allows you to add tasks to 4 different categories:

  • physical
  • emotional
  • financial
  • professional

Checking off tasks as complete in each category tells you what percent of that category you completed and the percents completed of each category are then averaged each week to tell you what percent of your weekly goal you accomplished. Pretty straight forward.

The twist I want to add in is the ability to assign different weights to the categories. So I might say that physical is given a 2, meaning that it's 2 times more "important" than the baseline. And that financial is given a -1.5, which obviously means it is less important than the categories still at baseline (emotional and professional) and WAY less important than physical.

In the first version prototyped, clicking a button displayed a set of sliders to adjust the weights for each category. Moving 1 slider to the right caused the remaining 3 to move to the left by the proportional amounts (and vice versa) so that there was a finite number of points to be assigned and changing the value for 1 caused the remaining the be recalculated. This was a UX nightmare.

So I'm now trying to figure out some way to calculate each category's "score" independently of the others based solely on its assigned "weight" (and a base value of course). this isn't complicated at all, but the problem is that if 1 or more categories are weighted highly enough, the average can end up being greater than 100%, which leads to the REAL problem of the possibility that even though 100% of the task were NOT completed, the final number might reflect that (or greater if not min(100, average_complete)ed).

I've been ramming my head into the wall to find a way (mathematically) to calculated a weighted average that still reflects a number higher than 0% if ANYTHING was completed and a number lower than 100% if ANYTHING was NOT completed... regardless of weight.

So my question is two-fold:

  1. is it even mathematically possible to do without recalculating all the values every time 1 changes?
  2. if NOT, are there any standard techniques used in software design to calculate a fuzzy yet somewhat accurate value just above 0% or below 100% in circumstances where the weights cause the actual value to go above or below respectively? **

** regarding #2, I can think of some workarounds from a UI/UX perspective to lessen the nightmare that resulted from the 1st prototype, but I'm inquiring here to see if there's a more "pure" way to do it programmatically/mathematically before we go down that path.

EDIT:

Here is a table with data. Each item has a base score of 100 (when completed)

ID | DONE | CATEGORY      | WT | SCORE
____________________________________
0  |  1    | physical     |  2 | 200
-----------------------------------    
1  |  1    | emotional    |  2 | 200
-----------------------------------
2  |  0    | financial    |  1 | 0
-----------------------------------
3  |  0    | professional |  1 | 0

(SCORE is calculated as DONE * 100 * WT)

Expected Average: 66.67%

EDIT 2:

https://docs.google.com/spreadsheets/d/1QQs3t4qRynWxJt96aNP8ylOzu1Gp3TgaXfqZlsCh-Jg/edit?usp=sharing - link to a functioning Google Sheet

The problem I'm having now is introducing negative weights for 1 or more of the categories. Doing so makes it possible for the sums of the scores to equal 0 (or less) which produces an average (when divided b total weights) or 0 (or less).

I know that in situations where statistical-type data is used, negative weights are generally "allowed", but in this case, all a negative weight means is that the category is LESS immportant than the baseline.

1

There are 1 best solutions below

7
samje On

For your first question, would it be a solution to store:

  1. a sum of all scores (sum of weight*percentage of complation)
  2. a sum of the weights

Then when you change one weight (say w1 becomes w1'), you can update 1. by adding (w1'-w1)*percentage1 (and you can do something similar if the percentage changes). You also update 2.

You then compute the global percentage with 1. divided by 2.

(Sorry I am not yet allowed to make commentary so I post this as an answer)