-
Notifications
You must be signed in to change notification settings - Fork 0
/
CvDataSplitter_help.txt
78 lines (59 loc) · 2.78 KB
/
CvDataSplitter_help.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Package for generating datasets for cross-validation purposes.
Learning parameters of a prediction function is a major objective. In order
to avoid over-fitting, the model is trained on a different data sample
(the 'training set') and evaluated out-of-sample on a so called 'test set'.
This approach is known as cross-validation (CV).
This package comprises different approaches of dividing the raw data set into
a training and test set, respectively, depending on the nature of the
underlying data.
An nice overview can be accessed here:
https://scikit-learn.org/stable/modules/cross_validation.html
The separated data sets are stored in array of matrices, which can be read-in
for the original model training and evaluation.
Written by: Artur Tarassow ([email protected])
Github project page & pull requests:
https://github.com/atecon/CvDataSplitter
Public Function:
================
CvDataSplitter()
Parameters:
===========
The user needs to pass some bundle 'b' in pointer form to the function
CvDataSplitter(), e.g. <CvDataSplitter(&b)>, which includes at least:
(i) A list named 'X' with k series, or a matrix named 'X' with T rows
and k columns.
In case a matrix 'X' was passed, the user additionally needs to pass
(ii) a column vector named 'index' referring to the T observations (can
be easily generated via gretl by 'genr index').
Additionally, the user can optionally specify the following 2 parameters:
cv_type -- string, Type of cross-validation (CV):
(i) 'kfold' (default),
(ii) 'loo' (Leave-One-Out)
(iii) 'recwin' (recursive window for time-series (TS) data)
(iv) 'rolwin' (rolling window using a fixed window-width
for TS data)
n_folds -- int, divide sample into n_folds of groups of equal
size (can only be set for cv_type='kfold' (default 5);
otherwise determined by the respective CV procedure)
win_size -- int, (Initial) Window-width for moving-window related
methods 'rolwin' and 'recwin' (default 25 pct. of total
valid observations)
Returns:
=========
The function returns the following information to the bundle 'b':
X_train -- array of 'n_folds' matrices, each matrix is of dimension
T(i) by (1+k) (for i=1,2,...) holding the observation
index in the 1st column and the training data for k
variables across columns.
X_test -- array of 'n_folds' matrices, each matrix is of dimension
T(j) by (1+k) (j=1,2,...) holding the observation index in the
1st column and the test data for k variables across columns.
## Changelog
### v0.3 (June 2021)
- Avoid dimension mismatch when concatenating index series with X matrix for both functions kfold() and timefold() in case of missing values.
### v0.2 (June 2021)
- Fix typos
- Catch error if number of folds exceeds number of observations.
- Minimum gretl version required is now 2020a
### v0.1 (March 2019)
- Initial version