<commit_before>(*
 * OWL - an OCaml math library for scientific computing
 * Copyright (c) 2016 <NAME> <<EMAIL>>
 *)

(** Statistics module

  The functions in this module are grouped based on their corresponding
  distributions. For each random variable distribution, e.g., distribution abc,
  there are usually six corresponding (if any) functions as follows:

  Please refer to GSL documentation using following linke for details:
  https://www.gnu.org/software/gsl/manual
*)


(** {6 Randomisation functions} *)

val seed : int -> unit
(** [seed x] sets x as seed for the internal random number generator.  *)

val shuffle : 'a array -> 'a array
(** [ shuffle x ] return a new array of the shuffled x  *)

val choose : 'a array -> int -> 'a array
(** [ choose x n ] draw n samples from x without replecement  *)

val sample : 'a array -> int -> 'a array
(** [ sample x n ] draw n samples from x with replacement  *)


(** {6 Basic statistical functions} *)

val mean : ?w:float array -> float array -> float

val variance : ?w:float array -> ?mean:float -> float array -> float

val std : ?w:float array -> ?mean:float -> float array -> float

val absdev : ?w:float array -> ?mean:float -> float array -> float

val skew : ?w:float array -> ?mean:float -> ?sd:float -> float array -> float

val kurtosis : ?w:float array -> ?mean:float -> ?sd:float -> float array -> float

val central_moment : int -> float array -> float

val covariance : ?mean0:float -> ?mean1:float -> float array -> float array -> float

val correlation : float array -> float array -> float

val pearson_r : float array -> float array -> float

val kendall_tau : float array -> float array -> float

val spearman_rho : float array -> float array -> float

val autocorrelation : ?lag:int -> float array -> float

val min : float array -> float

val max : float array -> float

val minmax : float array -> float * float

val min_i : float array -> float * int

val max_i : float array -> float * int

val minmax_i : float array -> float * int * float * int

val sort : ?inc:bool -> float array -> float array

val rank : float array -> float array
(** [ rank x ] translates each element in [x] to its ranking. The ranking Order
  is from the smallest one to the largest. E.g., [rank [|54.; 74.; 55.; 86.; 56.|]]
  returns [[|1.; 4.; 2.; 5.; 3.|]].
 *)


(** {6 MCMC: Markov Chain Monte Carlo} *)

val metropolis_hastings : (float array -> float) -> float array -> int -> float array array
(** [ metropolis_hastings f p n ] is Metropolis-Hastings MCMC algorithm.
  f is pdf of the p *)

val gibbs_sampling : (float array -> int -> float) -> float array -> int -> float array array
(** [ gibbs_sampling f p n ] is Gibbs sampler. f is a sampler based on the full
  conditional function of all variables *)


(** {6 Random numbers, PDF, and CDF} *)

module Rnd : sig

  (** Rnd module is for generating random variables of various distributions. *)

  (** {6 Continuous random variables} *)

  val uniform : unit -> float
  (** [uniform] returns a random float number within [0,1), includes 0.
      but excludes 1. *)

  val flat : float -> float -> float

  val gaussian : ?sigma:float -> unit -> float
  (** [gaussian ~sigma:s ()] returns the value of a random variable that
      follows Normal distribution of sigma = s. *)

  val gaussian_tail : float -> float -> float
  (** [ gaussian_tail a x sigma ] returns a random value of a gaussian tail
    distribution. note "a" must be positive. *)

  val bivariate_gaussian : float -> float -> float -> float * float
  (** [ bivariate_gaussian sigma_x sigma_y rho ] returns a pair of correlated
    gaussian variates, with mean zero, correlation coefficient rho [-1, 1] and
    standard deviations sigma_x and sigma_y in the x and y directions. *)

  val exponential : float -> float
  (** [ exponential mu ] return a random value *)

  val laplace : float -> float
  (** p(x) dx = {1 \over 2 a}  \exp(-|x/a|) dx  *)

  val exppow : float -> float -> float

  val cauchy : float -> float

  val rayleigh : float -> float

  val landau : unit -> float

  val levy : float -> float -> float

  val levy_skew : float -> float -> float -> float

  val gamma : float -> float -> float

  val lognormal : float -> float -> float

  val chisq : float -> float

  val dirichlet : float array -> float array -> unit

  val fdist : float -> float -> float

  val tdist : float -> float

  val beta : float -> float -> float

  val logistic : float -> float

  val pareto : float -> float -> float<commit_msg>document ...<commit_after>(*
 * OWL - an OCaml math library for scientific computing
 * Copyright (c) 2016 <NAME> <<EMAIL>>
 *)

(** Statistics module

  The functions in this module are grouped based on their corresponding
  distributions. For each random variable distribution, e.g., distribution abc,
  there are usually six corresponding (if any) functions as follows:

  Please refer to GSL documentation using following linke for details:
  https://www.gnu.org/software/gsl/manual
*)


(** {6 Randomisation functions} *)

val seed : int -> unit
(** [seed x] sets x as seed for the internal random number generator.  *)

val shuffle : 'a array -> 'a array
(** [ shuffle x ] return a new array of the shuffled x  *)

val choose : 'a array -> int -> 'a array
(** [ choose x n ] draw n samples from x without replecement  *)

val sample : 'a array -> int -> 'a array
(** [ sample x n ] draw n samples from x with replacement  *)


(** {6 Basic statistical functions} *)

val mean : ?w:float array -> float array -> float

val variance : ?w:float array -> ?mean:float -> float array -> float

val std : ?w:float array -> ?mean:float -> float array -> float

val absdev : ?w:float array -> ?mean:float -> float array -> float

val skew : ?w:float array -> ?mean:float -> ?sd:float -> float array -> float

val kurtosis : ?w:float array -> ?mean:float -> ?sd:float -> float array -> float

val central_moment : int -> float array -> float

val covariance : ?mean0:float -> ?mean1:float -> float array -> float array -> float

val correlation : float array -> float array -> float

val pearson_r : float array -> float array -> float

val kendall_tau : float array -> float array -> float

val spearman_rho : float array -> float array -> float

val autocorrelation : ?lag:int -> float array -> float

val min : float array -> float

val max : float array -> float

val minmax : float array -> float * float

val min_i : float array -> float * int

val max_i : float array -> float * int

val minmax_i : float array -> float * int * float * int

val sort : ?inc:bool -> float array -> float array

val rank : float array -> float array
(** [ rank x ] translates each element in [x] to its ranking. The ranking Order
  is from the smallest one to the largest. E.g., [rank [|54.; 74.; 55.; 86.; 56.|]]
  returns [[|1.; 4.; 2.; 5.; 3.|]]. Note that the ranking starts with one!
 *)


(** {6 MCMC: Markov Chain Monte Carlo} *)

val metropolis_hastings : (float array -> float) -> float array -> int -> float array array
(** [ metropolis_hastings f p n ] is Metropolis-Hastings MCMC algorithm.
  f is pdf of the p *)

val gibbs_sampling : (float array -> int -> float) -> float array -> int -> float array array
(** [ gibbs_sampling f p n ] is Gibbs sampler. f is a sampler based on the full
  conditional function of all variables *)


(** {6 Random numbers, PDF, and CDF} *)

module Rnd : sig

  (** Rnd module is for generating random variables of various distributions. *)

  (** {6 Continuous random variables} *)

  val flat : float -> float -> float
  (** [flat a b] draws a random number from the interval [[a,b)] with a uniform
    distribution.
   *)

  val uniform : unit -> float
  (** [uniform] returns a random float number within [0,1), includes 0.
      but excludes 1. [uniform ()] is equivalent to [flat 0. 1.]
   *)

  val gaussian : ?sigma:float -> unit -> float
  (** [gaussian ~sigma:s ()] returns the value of a random variable that
      follows Normal distribution of sigma = s. *)

  val gaussian_tail : float -> float -> float
  (** [ gaussian_tail a x sigma ] returns a random value of a gaussian tail
    distribution. note "a" must be positive. *)

  val bivariate_gaussian : float -> float -> float -> float * float
  (** [ bivariate_gaussian sigma_x sigma_y rho ] returns a pair of correlated
    gaussian variates, with mean zero, correlation coefficient rho [-1, 1] and
    standard deviations sigma_x and sigma_y in the x and y directions. *)

  val exponential : float -> float
  (** [ exponential mu ] return a random value that follows exponential distribution. *)

  val laplace : float -> float

  val exppow : float -> float -> float

  val cauchy : float -> float

  val rayleigh : float -> float

  val landau : unit -> float

  val levy : float -> float -> float

  val levy_skew : float -> float -> float -> float

  val gamma : float -> float -> float

  val lognormal : float -> float -> float

  val chisq : float -> float

  val dirichlet : float array -> float array -> unit

  val fdist : float -> float -> float

  val tdist : float -> float

  val beta : float -> float -> float

  val logistic : float -> float

  val pareto : float -> float -> float
{'fraction_non_alphanumeric': 0.11954870904751573, 'fraction_numerical': 0.007376871338685182, 'mean_word_length': 3.0292832167832167, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 201, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1916610', 'n_tokens_mistral': 2811, 'n_tokens_neox': 2594, 'n_words': 1215}