eval_params: Evaluates a given setting of lambda and mu on a given matrix...

View source: R/eval_params.R

eval_paramsR Documentation

Evaluates a given setting of lambda and mu on a given matrix with a given PCP function.

Description

eval_params evaluates a given setting of lambda and mu on a given matrix with a given PCP function. The given matrix has a given percentage of its entries randomly corrupted as missing NA values before evaluation. The parameter setting is scored by how well the given PCP function recovers those randomly corrupted values.

Usage

eval_params(seed, mat, pcp_func, perc_b, eval_params, ...)

Arguments

seed

The seed to use for the random corruption of the given matrix, mat.

mat

The data matrix to run PCP on.

pcp_func

The PCP function to use. Note: the PCP function passed must be able to handle missing NA values. For example: root_pcp_na.

perc_b

The percentage of mat to randomly corrupt as missing.

eval_params

A character vector containing the names of the parameters under evaluation.

...

The parameters to pass on to pcp_func.

lambda

The value of lambda to be passed to pcp_func.

mu

The value of mu to be passed to pcp_func.

Value

A vector of length containing the values of the parameters used, along with evaluation metrics.

See Also

corrupt_mat_randomly, grid_search_cv, random_search_cv, bayes_search_cv

Examples


library(pcpr) # since we will be passing grid_search_cv a PCP function 

# simulate a data matrix:

n <- 50
p <- 10
data <- sim_data(sim_seed = 1, nrow = n, ncol = p, rank = 3, sigma=0, add_sparse = FALSE)
mat <- data$M

# pick a parameter setting of lambda and mu to try:

lambda <- 1/sqrt(n)
mu <- sqrt(p/2)

# evaluate that setting:

score <- eval_params(lambda, mu, 1, mat, root_pcp_na, .2)

Columbia-PRIME/PCPhelpers documentation built on April 24, 2022, 7:57 p.m.