cross_validation
functionTrain and test splits
create_train_test_indices(
data,
cv_type = c("k-fold", "loo", "lpo"),
k = 5,
percentage = 20,
number_folds = 10
)
A list with two elements, train
containing the training indices and test
containing indices.
A list
, data.frame
, SpatialPointsDataFrame
or metric_graph_data
objects.
The type of the folding to be carried out. The options are k-fold
for k
-fold cross-validation, in which case the parameter k
should be provided,
loo
, for leave-one-out and lpo
for leave-percentage-out, in this case, the parameter percentage
should be given, and also the number_folds
with the number of folds to be done. The default is k-fold
.
The number of folds to be used in k
-fold cross-validation. Will only be used if cv_type
is k-fold
.
The percentage (from 1 to 99) of the data to be used to train the model. Will only be used if cv_type
is lpo
.
Number of folds to be done if cv_type
is lpo
.