Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Approximate logarithmic statistical module: new() params naming

by Dallaylaen (Chaplain)
on Apr 16, 2015 at 06:37 UTC ( [id://1123586]=perlquestion: print w/replies, xml ) Need Help??

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:

  • base - base of logarithmic intervals, i.e. upper_bound/lower_bound;
  • precision - width of linear intervals around zero;
  • zero_thresh - optional threshold at which to switch to linear, normally it's calculated dynamically (we want to switch where the linear and logarithmic intervals are of the same width).

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.

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?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1123586]
Approved by kevbot
Front-paged by kcott
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-03-29 09:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found