MCPcopy Index your code
hub / github.com/gonum/plot / density

Function density

labelling.go:242–249  ·  view source on GitHub ↗

density returns the density score which measures the goodness of the labelling density compared to the user defined target based on the want parameter given to talbotLinHanrahan.

(have, want int, dMin, dMax, lMin, lMax float64)

Source from the content-addressed store, hash-verified

240// the labelling density compared to the user defined target
241// based on the want parameter given to talbotLinHanrahan.
242func density(have, want int, dMin, dMax, lMin, lMax float64) float64 {
243 rho := float64(have-1) / (lMax - lMin)
244 rhot := float64(want-1) / (math.Max(lMax, dMax) - math.Min(dMin, lMin))
245 if d := rho / rhot; d >= 1 {
246 return 2 - d
247 }
248 return 2 - rhot/rho
249}
250
251// maxDensity returns the maximum density score achievable for have and want.
252func maxDensity(have, want int) float64 {

Callers 1

talbotLinHanrahanFunction · 0.85

Calls 2

MaxMethod · 0.65
MinMethod · 0.65

Tested by

no test coverage detected