# Talk:Functional coverage tree

## Data in a more functional form

I did not use the above, but thought I should generate it. --Paddy3118 (talk) 20:02, 12 August 2015 (UTC)

But I've used it subsequently in the Python class-based version as I wanted the task to focus more on the calculations in the tree and the display of output in textual form that might normally be done in something like this treetable or this treetable. --Paddy3118 (talk) 07:12, 15 August 2015 (UTC)

### Weighted sums

The specified weights look like they are meant to be percentages (all=100), but the specification for missing weights seems to be fractional (all=1). I think that this deserves either a bit more explanation (as to why the use of "1" for default weight is correct) or correction. --Rdm (talk) 01:53, 13 August 2015 (UTC)

Hi Rdm, Those weights are not percentages - They are "fractions of the sum of the weights" at that level. I was playing around with what weight to apply to house1 and house2 and rejected 1, 2 then eventually considered 2, 3 and realised that for those integers it would be the same as 4, 6 and 40, 60 - saw the total weight being 100, and the:
1. Ease of hand calculation.
2. Similarity to prcentages.
And so went with that. Never thinking that it might confuse rather than help.
Here are some doodles around the weighted average calculation:
<lang python>>>> def wt_avg(wt, cov):

... wts = sum(wt) ... covs = sum(c * w for c, w in zip(cov, wt)) ... return covs / wts ... >>> weights = [1, 1] >>> child_cov = [0.25, 0.75] >>> wt_avg(weights, child_cov) 0.5 >>> weights = [2, 3] >>> wt_avg(weights, child_cov) 0.55 >>> weights = [4, 6] >>> wt_avg(weights, child_cov) 0.55 >>> weights = [40, 60] >>> wt_avg(weights, child_cov) 0.55 >>> >>> # From wikipedias basic example: >>> weights = [20, 30] >>> child_cov = [80, 90] >>> wt_avg(weights, child_cov) 86.0 >>> </lang>

### Tightening up the description of the coverage calculation ?

The given formulation of the coverage values of nodes sounds like a statement about all nodes in the tree, but is in fact, of course, valid only for a minority of them.

(It's valid for those which have children – but the majority are leaf nodes, with coverage values which are direct and supplied rather than computed. If we took the task description literally, the coverage value of all leaf nodes, and hence of all parent nodes too, would be zero, or perhaps just undefined).

Perhaps worth tightening up that sentence, or adding one to cover the majority case, in which the number of children is zero ? Hout (talk) 18:49, 13 October 2019 (UTC)