Dallaylaen has asked for the wisdom of the Perl Monks concerning the following question:

Suppose we have a module for approximate memory-efficient statistical analysis which stores data in a set of logarithmic bins. However, around zero, depending on the data, it may be suitable to switch to linear interpolation (as in "no measurement is absolutely precise, why use so many bins").

For now, the proposed new() interface (has not been released to CPAN) is as follows:

I'm ok with my data model, but the parameter names seem a bit weird.

I would like to rename them to relative_precision, absolute_precision, and linear_threshold respectively. Does that look clear enough?

I was also thinking of absolute/relative error, but error is really variable and no more than half the precision. I think this could cause additional WTF.

Are there any better ideas?

The module in question is Statistics::Descriptive::LogScale. Here's the previous discussion.

  • Comment on Approximate logarithmic statistical module: new() params naming

Replies are listed 'Best First'.
Re: Approximate logarithmic statistical module: new() params naming
by CountZero (Bishop) on Apr 17, 2015 at 06:21 UTC
    I think relative_precision and absolute_precision are not very expressive. base is more clear as it refers to the basic binning strategy. Perhaps you can call it log_base to make it even more clear. You could then replace precision with linear_width or such. linear_threshold fits nicely into that pattern.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics

      Thanks a lot for your reply. The more I think of it, the more I like it.

      How should I refer to you in the "thanks" section in case I stick to your naming scheme? Name, CPAN id, whatever?