Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Useful heuristics for analyzing arrays of data to determine column header

by nysus (Vicar)
on Feb 17, 2019 at 10:44 UTC ( #1230028=note: print w/replies, xml ) Need Help??


in reply to Re: Useful heuristics for analyzing arrays of data to determine column header
in thread Useful heuristics for analyzing arrays of data to determine column header

Making some progress on the module. So here's some sample data for a column with the raw count and cardinality value for each unique value in the column:

$VAR1 = { 'ACTIVE' => { 'count' => 1941, 'value_card' => '0.631630328669053' }, 'INACTIVE' => { 'value_card' => '0.233322486169867', 'count' => 717 }, 'RETIRED' => { 'count' => 414, 'value_card' => '0.134721770257078' }, 'STATUS' => { 'count' => 1, 'value_card' => '0.000325414904002603' } };

So in this simple case, the 'STATUS' value is unique to this column and is clearly an outlier from the other three possible values. But in fuzzier situations, how would I determine whether 'STATUS' is "1 standard deviation" away from the other value cardinality values?

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

  • Comment on Re^2: Useful heuristics for analyzing arrays of data to determine column header
  • Download Code

Replies are listed 'Best First'.
Re^3: Useful heuristics for analyzing arrays of data to determine column header
by bliako (Vicar) on Feb 18, 2019 at 13:16 UTC
    how would I determine whether 'STATUS' is "1 standard deviation" away from the other value cardinality values? 

    Find the mean (m) and standard deviation (s) over all the "value_card" values from that column (or the combined-over-single-row "value_card" values). The distance of "STATUS"'s "value_card" from another entry's value card, say 'ACTIVE' is their absolute difference. The distance in terms of standard deviations is the previous value divided by the standard deviation. That will tell you how many standard deviations apart they are.

    But this gets less and less trustworthy as the number of value_cards gets smaller. For example, this online outlier tool sees 1 outlier but it is not what we think it is!!! https://www.graphpad.com/quickcalcs/grubbs2/ (got it from How to best eliminate values in a list that are outliers which maybe relevant to your problem)

    bw, bliako

Re^3: Useful heuristics for analyzing arrays of data to determine column header
by soonix (Abbot) on Feb 17, 2019 at 14:34 UTC
    Headers are usually in the first line, so if that sigle "STATUS" is on another line than the first, it isn't a header...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1230028]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2019-10-22 22:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?