riatelab/statsbreaks

Improving behavior of `precision` option ?

Closed this issue · 3 comments

mthh commented

I think the behaviour of the precision option could be improved.
Currently, if it is not defined by the user or if it is set to null, statsbreaks uses the default value 2.

This is not convenient for managing values with very small deviations.
See this example notebook: https://observablehq.com/d/8718bcca12154e30.

Expected behavior:

  1. (in my opinion, it's essential) don't round break values when precision is explicitely set to null by the user
  2. (maybe, or in a second time) use a better default than 2 when precision is left undefined by the user (by computing it from the user data)

I'm currently exploring different options for point 2 (for example, with the values of my notebook, the method used by geostats would have proposed a precision of 20, which would not have been enough) but I think that point 1 should be solved first.

No particular opinion there. Okay to go your way.

mthh commented

I will first fix the first point (because it hurts user experience in my opinion) and see for a 2nd PR in a few days.

mthh commented

In fact there is a few ways to implement point n°1.

  • If precision is set to null it means that the user dont want to round break values. ✔️
  • But, if precision is left undefined, what do you prefer ? Still using a default precision value ? Dont round the break values ?
  • If precision is not an integer number, what do you prefer ? Throwing an error ? Using a default precision ? Dont round the break values ?