coverage returns the coverage score for based on the average squared distance between the extreme labels, lMin and lMax, and the extreme data points, dMin and dMax.
(dMin, dMax, lMin, lMax float64)
| 218 | // squared distance between the extreme labels, lMin and lMax, and |
| 219 | // the extreme data points, dMin and dMax. |
| 220 | func coverage(dMin, dMax, lMin, lMax float64) float64 { |
| 221 | r := 0.1 * (dMax - dMin) |
| 222 | max := dMax - lMax |
| 223 | min := dMin - lMin |
| 224 | return 1 - 0.5*(max*max+min*min)/(r*r) |
| 225 | } |
| 226 | |
| 227 | // maxCoverage returns the maximum coverage achievable for the data |
| 228 | // range. |