public static Distribution guessNumberOfBins ( DataSet data ) { if ( data . size ( ) < 20 ) return new UniformDiscrete ( 2 , data . size ( ) - 1 ) ; else if ( data . size ( ) >= 1000000 ) return new LogUniform ( 50 , 1000 ) ; int sqrt = ( int ) Math . sqrt ( data . size ( ) ) ; return new UniformDiscrete ( Math . max ( sqrt / 3 , 2 ) , Math . min ( sqrt * 3 , data . size ( ) - 1 ) ) ; }
Attempts to guess the number of bins to use