maxSimplicity returns the maximum simplicity for q, Q and skip.
(q float64, Q []float64, skip int)
| 206 | |
| 207 | // maxSimplicity returns the maximum simplicity for q, Q and skip. |
| 208 | func maxSimplicity(q float64, Q []float64, skip int) float64 { |
| 209 | for i, v := range Q { |
| 210 | if v == q { |
| 211 | return 1 - float64(i)/(float64(len(Q))-1) - float64(skip) + 1 |
| 212 | } |
| 213 | } |
| 214 | panic("labelling: invalid q for Q") |
| 215 | } |
| 216 | |
| 217 | // coverage returns the coverage score for based on the average |
| 218 | // squared distance between the extreme labels, lMin and lMax, and |