Takein operation splits horizontally input PSG Matrix in N equally-sized sub-matrices and includes one sub-matrix in the output matrix. Takein and Cutout operations can be used, for instance, in N-fold cross-validation in statistical procedures, such as linear regression.
Syntax
Takein(k,N,<matrix_init>),
<matrix_init> |
name of input PSG Matrix; |
N |
number of (approximately) equally-sized sub-matrices; |
k |
sub-matrix number included in the output matrix. |
Description
Takein operation splits the input matrix "<matrix_init>" in N approximately equal sub-matrices, and creates an output matrix including only k-th sub-matrix.
Example
Input matrix:
matrix_fact19:
x1 |
x2 |
scenario_benchmark |
-2 |
2 |
1 |
0 |
10 |
2 |
1 |
-1 |
15 |
5 |
15 |
11 |
7 |
-7 |
3 |
11 |
12 |
1 |
2 |
21 |
1 |
12 |
-2 |
11 |
19 |
9 |
4 |
15 |
5 |
15 |
17 |
7 |
3 |
9 |
-19 |
9 |
-12 |
5 |
7 |
10 |
1 |
2 |
13 |
3 |
8 |
25 |
5 |
12 |
-7 |
7 |
3 |
31 |
-3 |
1 |
3 |
3 |
13 |
For instance, operation takein(2,3,matrix_fact19)splits input matrix, matrix_fact19, in three sub-matrices:
sub-matrix 1
-2 |
2 |
1 |
0 |
10 |
2 |
1 |
-1 |
15 |
5 |
15 |
11 |
7 |
-7 |
3 |
11 |
12 |
1 |
2 |
21 |
1 |
sub-matrix 2
12 |
-2 |
11 |
19 |
9 |
4 |
15 |
5 |
15 |
17 |
7 |
3 |
9 |
-19 |
9 |
-12 |
5 |
7 |
sub-matrix 3
10 |
1 |
2 |
13 |
3 |
8 |
25 |
5 |
12 |
-7 |
7 |
3 |
31 |
-3 |
1 |
3 |
3 |
13 |
Output matrix includes only sub-matrix 2:
12 |
-2 |
11 |
19 |
9 |
4 |
15 |
5 |
15 |
17 |
7 |
3 |
9 |
-19 |
9 |
-12 |
5 |
7 |
See also
Block Operation for Matrix, Cutout Operation for Matrix, CrossValidation Operation for Matrix.