Diversity prediction theorem: Difference between revisions
Content added Content deleted
m (→version 2: added a missing line.) |
m (→version 2: changed quote style, added whitespace to some statements.) |
||
Line 1,262: | Line 1,262: | ||
exit 0 /*stick a fork in it, we're all done. */ |
exit 0 /*stick a fork in it, we're all done. */ |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
avg: $=0; do j=1 for #; |
avg: $= 0; do j=1 for #; $= $ + word(x, j) ; end; return $ / # |
||
avgSD: $=0; arg y; do j=1 for #; |
avgSD: $= 0; arg y; do j=1 for #; $= $ + (word(x, j) - y)**2; end; return $ / # |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
diversity: parse arg true, x; #= words(x); a= avg() /*get args; count #est; avg*/ |
diversity: parse arg true, x; #= words(x); a= avg() /*get args; count #est; avg*/ |
||
say ' the true value: ' true copies("═", 20) |
say ' the true value: ' true copies("═", 20) "crowd estimates: " x |
||
say ' the average error: ' format( avgSD(true) , , 6) / 1 |
say ' the average error: ' format( avgSD(true) , , 6) / 1 |
||
say ' the crowd error: ' format( (true-a) **2, , 6) / 1 |
say ' the crowd error: ' format( (true-a) **2, , 6) / 1 |