The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

GitInsight::Util - A set of functions that uses PDL to produce stats

SYNOPSIS

    use GitInsight::Util qw(prob label);
    my $prob = prob(100,50); #gives probability using pdf_beta of PDL

DESCRIPTION

This package contains some functions that uses PDL to do some scientific calculations.

EXPORTED FUNCTIONS

prob()

calculate the probability using bayesian inference (pdf_beta of PDL::Stats). requires two argument, the total number of trials and the watched events that actually matched.

wday()

Requires a date in string, with this format:

    my $day=wday("2014-03-15")
    #$day is Tue

returns the weekday of the given date

gen_trans_mat()

Accept an argument, 1 or 0, 1 enable no_day_stats, and it causes to return an empty zero padded piddle. If the argument is 0 it returns an hashref wich keys are the wdays that contains empty padded zero piddle

gen_m_mat()

Given a label number as argument, it generates a zero padded matrix of 1 row and of n columns as the label available, with having a 1 only set at the specified label. (used for calculating the prediction)

markov

requires 3 arguments: the matrix that selects the state (generated by gen_m_mat), the transiction matrix, and the power that must be applied at the transition matrix. It returns a PDL piddle containing the probability for each next state

markov_list

requires 3 arguments: the matrix that selects the state (generated by gen_m_mat), the transiction matrix, and the power that must be applied at the transition matrix. It returns a Perl list containing the probability for each next state.

markov_prob

requires 3 arguments: the matrix that selects the state (generated by gen_m_mat), the transiction matrix, and the power that must be applied at the transition matrix. It returns the maximum probability between the future states.

label

requires 1 argument: the number of commit to be assigned the appropriate label It returns the assigned label

label_step

requires an array composed by [0,n] where n is the maximum commit count ever had in a day of the contribution calendar. it sets the internal data structure to be able to call label()

info/error/warning

Just used to print the output to the terminal:

    info "All ok"
    error "Something bad happened"
    warning "uh oh!"

AUTHOR

mudler <mudler@dark-lab.net>

COPYRIGHT

Copyright 2014- mudler

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

GitInsight, PDL, PDL::Stats