split Interface

public interface split

Split an array into train and test sets

This procedure splits an array into two sets along one dimension. The array can be of any rank, but the dimension along which to split must be specified. An optional index array can also be split. The size of the left and right splits can also be specified. The data can be shuffled before splitting.


Module Procedures

private subroutine split_2Drdata_1Drlist(data, label, left_data, right_data, left_label, right_label, dim, left_size, right_size, shuffle, seed, split_list)

Split a 2D array along one dimension

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(in), dimension(:,:) :: data

2D array to be split

real(kind=real32), intent(in), dimension(:) :: label

1D array to be split

real(kind=real32), intent(out), allocatable, dimension(:,:) :: left_data

2D arrays to store the left and right splits

real(kind=real32), intent(out), allocatable, dimension(:,:) :: right_data

2D arrays to store the left and right splits

real(kind=real32), intent(out), allocatable, dimension(:) :: left_label

1D arrays to store the left and right splits

real(kind=real32), intent(out), allocatable, dimension(:) :: right_label

1D arrays to store the left and right splits

integer, intent(in) :: dim

Dimension along which to split

real(kind=real32), intent(in), optional :: left_size

Size of the left and right splits

real(kind=real32), intent(in), optional :: right_size

Size of the left and right splits

logical, intent(in), optional :: shuffle

Shuffle the data before splitting

integer, intent(in), optional :: seed

Random seed

integer, intent(out), optional, dimension(size(data,dim)) :: split_list

Index array

private subroutine split_3Didata_1Dilist(data, label, left_data, right_data, left_label, right_label, dim, left_size, right_size, shuffle, seed, split_list)

Arguments

Type IntentOptional Attributes Name
integer, intent(in), dimension(:,:,:) :: data

3D array to be split

integer, intent(in), dimension(:) :: label

1D array to be split

integer, intent(out), allocatable, dimension(:,:,:) :: left_data

3D arrays to store the left and right splits

integer, intent(out), allocatable, dimension(:,:,:) :: right_data

3D arrays to store the left and right splits

integer, intent(out), allocatable, dimension(:) :: left_label

1D arrays to store the left and right splits

integer, intent(out), allocatable, dimension(:) :: right_label

1D arrays to store the left and right splits

integer, intent(in) :: dim

Dimension along which to split

real(kind=real32), intent(in), optional :: left_size

Size of the left and right splits

real(kind=real32), intent(in), optional :: right_size

Size of the left and right splits

logical, intent(in), optional :: shuffle

Shuffle the data before splitting

integer, intent(in), optional :: seed

Random seed

integer, intent(out), optional, dimension(size(data,dim)) :: split_list

Index array

private subroutine split_3Didata_1Drlist(data, label, left_data, right_data, left_label, right_label, dim, left_size, right_size, shuffle, seed, split_list)

Split a 3D array along one dimension

Arguments

Type IntentOptional Attributes Name
integer, intent(in), dimension(:,:,:) :: data

3D array to be split

real(kind=real32), intent(in), dimension(:) :: label

1D array to be split

integer, intent(out), allocatable, dimension(:,:,:) :: left_data

3D arrays to store the left and right splits

integer, intent(out), allocatable, dimension(:,:,:) :: right_data

3D arrays to store the left and right splits

real(kind=real32), intent(out), allocatable, dimension(:) :: left_label

1D arrays to store the left and right splits

real(kind=real32), intent(out), allocatable, dimension(:) :: right_label

1D arrays to store the left and right splits

integer, intent(in) :: dim

Dimension along which to split

real(kind=real32), intent(in), optional :: left_size

Size of the left and right splits

real(kind=real32), intent(in), optional :: right_size

Size of the left and right splits

logical, intent(in), optional :: shuffle

Shuffle the data before splitting

integer, intent(in), optional :: seed

Random seed

integer, intent(out), optional, dimension(size(data,dim)) :: split_list

Index array

private subroutine split_5Drdata(data, left, right, dim, left_size, right_size, shuffle, seed)

Split a 5D array along one dimension

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(in), dimension(:,:,:,:,:) :: data

5D array to be split

real(kind=real32), intent(out), allocatable, dimension(:,:,:,:,:) :: left

5D arrays to store the left and right splits

real(kind=real32), intent(out), allocatable, dimension(:,:,:,:,:) :: right

5D arrays to store the left and right splits

integer, intent(in) :: dim

Dimension along which to split

real(kind=real32), intent(in), optional :: left_size

Size of the left and right splits

real(kind=real32), intent(in), optional :: right_size

Size of the left and right splits

logical, intent(in), optional :: shuffle

Shuffle the data before splitting

integer, intent(in), optional :: seed

Random seed

private subroutine split_5Drdata_1Drlist(data, label, left_data, right_data, left_label, right_label, dim, left_size, right_size, shuffle, seed, split_list)

Split a 5D array along one dimension

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(in), dimension(:,:,:,:,:) :: data

5D array to be split

real(kind=real32), intent(in), dimension(:) :: label

1D array to be split

real(kind=real32), intent(out), allocatable, dimension(:,:,:,:,:) :: left_data

5D arrays to store the left and right splits

real(kind=real32), intent(out), allocatable, dimension(:,:,:,:,:) :: right_data

5D arrays to store the left and right splits

real(kind=real32), intent(out), allocatable, dimension(:) :: left_label

1D arrays to store the left and right splits

real(kind=real32), intent(out), allocatable, dimension(:) :: right_label

1D arrays to store the left and right splits

integer, intent(in) :: dim

Dimension along which to split

real(kind=real32), intent(in), optional :: left_size

Size of the left and right splits

real(kind=real32), intent(in), optional :: right_size

Size of the left and right splits

logical, intent(in), optional :: shuffle

Shuffle the data before splitting

integer, intent(in), optional :: seed

Random seed

integer, intent(out), optional, dimension(size(data,dim)) :: split_list

Index array