View source: R/adaptive_sampling.R
likelihood_function | R Documentation |
This internal function calculates the cross-validated likelihood for a given set of parameters. It splits the data into training and validation sets across multiple folds, fits the topolow model on each training set, and evaluates the error on the corresponding validation set.
likelihood_function(
dissimilarity_matrix,
mapping_max_iter,
relative_epsilon,
N,
k0,
cooling_rate,
c_repulsion,
folds = 20,
num_cores = 1
)
dissimilarity_matrix |
The input dissimilarity matrix to fit. |
mapping_max_iter |
The maximum number of optimization iterations. |
relative_epsilon |
The convergence threshold for optimization. |
N |
The number of dimensions for the embedding. |
k0 |
The initial spring constant. |
cooling_rate |
The spring constant decay rate. |
c_repulsion |
The repulsion constant. |
folds |
The number of cross-validation folds. |
num_cores |
The number of cores for parallel processing. |
To calculate a single Negative Log-Likelihood (NLL) value per parameter set, the function uses a "pooled errors" approach. It combines all out-of-sample errors from every fold into a single set before calculating the NLL and the overall Mean Absolute Error (MAE). This method respects the underlying error distribution and correctly accounts for the total number of validation points.
A list containing the pooled Holdout_MAE
and the NLL
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.