fsml_dat Module

Module for basic sample statistics.


Uses

  • module~~fsml_dat~~UsesGraph module~fsml_dat fsml_dat module~fsml_err fsml_err module~fsml_dat->module~fsml_err module~fsml_ini fsml_ini module~fsml_dat->module~fsml_ini module~fsml_utl fsml_utl module~fsml_dat->module~fsml_utl module~fsml_err->module~fsml_ini ieee_arithmetic ieee_arithmetic module~fsml_ini->ieee_arithmetic iso_fortran_env iso_fortran_env module~fsml_ini->iso_fortran_env stdlib_linalg stdlib_linalg module~fsml_ini->stdlib_linalg module~fsml_utl->module~fsml_ini

Used by

  • module~~fsml_dat~~UsedByGraph module~fsml_dat fsml_dat module~fsml fsml module~fsml->module~fsml_dat module~fsml_nlp fsml_nlp module~fsml->module~fsml_nlp module~fsml_sts fsml_sts module~fsml->module~fsml_sts module~fsml_tst fsml_tst module~fsml->module~fsml_tst module~fsml_lin fsml_lin module~fsml->module~fsml_lin module~fsml_nlp->module~fsml_dat module~fsml_nlp->module~fsml_sts module~fsml_nlp->module~fsml_lin module~fsml_sts->module~fsml_dat module~fsml_tst->module~fsml_dat module~fsml_tst->module~fsml_sts module~fsml_lin->module~fsml_sts

Subroutines

public pure subroutine s_dat_rank(x, ranks)

Ranks all samples such that the smallest value obtains rank 1 and the largest rank n. Handles tied ranks and assigns average rank to tied elements within one group of tied elements.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x(:)

x array

real(kind=wp), intent(out), allocatable :: ranks(:)

ranks of x

public subroutine s_dat_sample_k(m, k, mask)

Subroutine for creating k ~equal-sized samples of a rank-1 array. The array indices are shuffled using the Fisher–Yates algorithm. Then, k logical masks are constructed. In each mask, the indices belonging to one of the k folds (not part of the sample) are set to .false. and the remaining indices are set to .true., making the masks directly suitable for k-fold cross-validation.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=i4), intent(in) :: m

size of population (array)

integer(kind=i4), intent(in) :: k

number of subsample sets

logical, intent(out) :: mask(m,k)

index mask for sampled data

public subroutine s_dat_sample_n(m, n, mask)

Subroutine for sampling a rank 1 array. It shuffles indeces using the forward Fisher-Yates algorithm (as needed given n), then generates an index mask from it. The mask can simply be applied using the pack intrinsic function: new_array = pack (old_array, mask)

Arguments

Type IntentOptional Attributes Name
integer(kind=i4), intent(in) :: m

size of population (array)

integer(kind=i4), intent(in) :: n

size of sample

logical, intent(out) :: mask(m)

index mask for sampled data

public subroutine s_dat_sample_p(m, p, mask)

Subroutine for sampling a rank 1 array using Poisson sampling (subjecting individual elements independently to Bernoulli experiments), then generates an index mask for sampling. The mask can simply be applied using the pack intrinsic function: new_array = pack (old_array, mask)

Arguments

Type IntentOptional Attributes Name
integer(kind=i4), intent(in) :: m

size of population (array)

real(kind=wp), intent(in) :: p

inclusion probability

logical, intent(out) :: mask(m)

index mask for sampled data

public pure subroutine s_dat_sort(a_in, n, mode, idx_in, a_out, idx_out)

Sort real array in ascending (mode=1) or descending (mode=2) order. Preserves the input array. Outputs sorted array and index mapping.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: a_in(n)

input array (unchanged)

integer(kind=i4), intent(in) :: n

number of elements

integer(kind=i4), intent(in) :: mode

1=ascending, 2=descending

integer(kind=i4), intent(in) :: idx_in(n)

initial index mapping

real(kind=wp), intent(out) :: a_out(n)

sorted output array

integer(kind=i4), intent(out) :: idx_out(n)

updated index mapping