Create train and test splits to be used in the cross_validation
function
Source: R/util.R
create_train_test_indices.Rd
Train and test splits
Usage
create_train_test_indices(
data,
cv_type = c("k-fold", "loo", "lpo"),
k = 5,
percentage = 20,
number_folds = 10
)
Arguments
- data
A
list
,data.frame
,SpatialPointsDataFrame
ormetric_graph_data
objects.- cv_type
The type of the folding to be carried out. The options are
k-fold
fork
-fold cross-validation, in which case the parameterk
should be provided,loo
, for leave-one-out andlpo
for leave-percentage-out, in this case, the parameterpercentage
should be given, and also thenumber_folds
with the number of folds to be done. The default isk-fold
.- k
The number of folds to be used in
k
-fold cross-validation. Will only be used ifcv_type
isk-fold
.- percentage
The percentage (from 1 to 99) of the data to be used to train the model. Will only be used if
cv_type
islpo
.- number_folds
Number of folds to be done if
cv_type
islpo
.