create_cv_folds {topolow} | R Documentation |
Create Cross-validation Folds for Distance Matrix
Description
Creates k-fold cross-validation splits of a distance matrix while maintaining symmetry. Each fold has a training matrix with some values masked for validation.
Usage
create_cv_folds(
truth_matrix,
no_noise_truth = NULL,
n_folds = 10,
random_seed = NULL
)
Arguments
truth_matrix |
Matrix of true distances |
no_noise_truth |
Optional matrix of noise-free distances. If provided, used as truth. |
n_folds |
Integer number of folds to create |
random_seed |
Integer random seed for reproducibility |
Value
A list of length n_folds
. Each element is a list containing two matrices:
truth |
The truth matrix for that fold. |
train |
The training matrix with some values replaced by |
Examples
# Create a sample distance matrix
dist_matrix <- matrix(runif(100), 10, 10)
diag(dist_matrix) <- 0
# Create 5-fold CV splits
folds <- create_cv_folds(dist_matrix, n_folds = 5, random_seed = 123)
[Package topolow version 1.0.0 Index]