Title: | An Implementation of the RESTK Algorithm |
---|---|
Description: | Implementation of the RESTK algorithm based on Markov's Inequality from Vilardell, Sergi, Serra, Isabel, Mezzetti, Enrico, Abella, Jaume, Cazorla, Francisco J. and Del Castillo, J. (2022). "Using Markov's Inequality with Power-Of-k Function for Probabilistic WCET Estimation". In 34th Euromicro Conference on Real-Time Systems (ECRTS 2022). Leibniz International Proceedings in Informatics (LIPIcs) 231 20:1-20:24. <doi:10.4230/LIPIcs.ECRTS.2022.20>. This work has been supported by the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme (grant agreement No. 772773). |
Authors: | Sergi Vilardell [aut, cre] |
Maintainer: | Sergi Vilardell <[email protected]> |
License: | GPL-3 |
Version: | 1.0.0 |
Built: | 2024-11-14 06:24:22 UTC |
Source: | CRAN |
compute_maxk
returns the estimated quantiles for the chosen probabilities from the input sample.
This method uses the sample quantile method number 8 from the default quantile function.
compute_maxk(samp = NULL, probs = NULL, quants = NULL, k_range = c(1, 120))
compute_maxk(samp = NULL, probs = NULL, quants = NULL, k_range = c(1, 120))
samp |
Sample of data to model |
probs |
Probabilities of interest to generate the max_k line |
quants |
Estimated quantiles of interest to generate the max_k line |
k_range |
Range of k values for the optimization function |
Returns estimated maxk for the sample and quantiles given.
samp <- rnorm(1e3, mean = 100, sd = 10) probs <- c(1-1e-1, 1-0.5e-1, 1-1e-2) quants <- c(100, 125, 150) estimated_max_k <- compute_maxk(samp = samp, probs = probs, quants = quants, k_range = c(1,100))
samp <- rnorm(1e3, mean = 100, sd = 10) probs <- c(1-1e-1, 1-0.5e-1, 1-1e-2) quants <- c(100, 125, 150) estimated_max_k <- compute_maxk(samp = samp, probs = probs, quants = quants, k_range = c(1,100))
estimate_quantiles_maxk
use the maxk line obtained to estimate quantiles with MIK
estimate_quantiles_maxk(samp = NULL, maxk_line = NULL, probs_interest = NULL)
estimate_quantiles_maxk(samp = NULL, maxk_line = NULL, probs_interest = NULL)
samp |
sample |
maxk_line |
maxk line obtained for the probabilities of interest |
probs_interest |
Probabilities of interest to estimate |
Returns the estimation of the quantiles using the maxk line
linear_adjust(min_maxk = c(10, 15, 20), probs = c(1-1e-1, 1-1e-2, 1-1e-3), probs_interest = c(1-1e-6, 1-1e-7, 1-1e-8))
linear_adjust(min_maxk = c(10, 15, 20), probs = c(1-1e-1, 1-1e-2, 1-1e-3), probs_interest = c(1-1e-6, 1-1e-7, 1-1e-8))
get_min_maxk
get the minimum maxk from a set of maxks and tightness
get_min_maxk(samp_tightness = NULL, k_seq = NULL)
get_min_maxk(samp_tightness = NULL, k_seq = NULL)
samp_tightness |
tightness from a given sample and maxk |
k_seq |
sequence of maxk to evaluate |
Returns the minimum maxk
get_min_maxk(samp_tightness = c(1.5, 1.2, 0.98), k_seq = c(20, 30 , 40))
get_min_maxk(samp_tightness = c(1.5, 1.2, 0.98), k_seq = c(20, 30 , 40))
linear_adjust
function used to project the max_k line into the probabilities of interest
linear_adjust(min_maxk = NULL, probs = NULL, probs_interest)
linear_adjust(min_maxk = NULL, probs = NULL, probs_interest)
min_maxk |
minimum maxk found for each probability of interest |
probs |
Probabilities where maxk was evaluated |
probs_interest |
Probabilities of interest to estimate |
Returns the maxk line for the probabilities of interest
linear_adjust(min_maxk = c(10, 15, 20), probs = c(1-1e-1, 1-1e-2, 1-1e-3), probs_interest = c(1-1e-6, 1-1e-7, 1-1e-8))
linear_adjust(min_maxk = c(10, 15, 20), probs = c(1-1e-1, 1-1e-2, 1-1e-3), probs_interest = c(1-1e-6, 1-1e-7, 1-1e-8))
RESTK
function used to project the maxk line into the probabilities of interest
RESTK( training_data = NULL, validation_data = NULL, probs = NULL, probs_interest = NULL, bootstrap_size = NULL, bootstrap_training_sims = NULL, bootstrap_validation_sims = NULL )
RESTK( training_data = NULL, validation_data = NULL, probs = NULL, probs_interest = NULL, bootstrap_size = NULL, bootstrap_training_sims = NULL, bootstrap_validation_sims = NULL )
training_data |
training data |
validation_data |
validation data |
probs |
Probabilities where maxk was evaluated |
probs_interest |
Probabilities of interest to estimate |
bootstrap_size |
size of bootstrap simulations on the training data |
bootstrap_training_sims |
number of bootstrap simulations on the training data |
bootstrap_validation_sims |
number of bootstrap simulations on the validation data |
Returns the maxk line for the probabilities of interest
training_data <- rnorm(1e3, mean = 100, sd = 10) validation_data <- rnorm(1e3, mean = 100, sd = 10) bootstrap_size <- 1000 bootstrap_training_sims <- 10 bootstrap_validation_sims <- 10 probs <- c(1-1e-1, 1-0.5e-1, 1-1e-2) probs_interest <- c(1-1e-6, 1-1e-7) maxk_line <- c(100, 125, 150) estimated_quants <- RESTK(training_data = training_data, validation_data = validation_data, probs = probs, probs_interest = probs_interest, bootstrap_size = bootstrap_size, bootstrap_training_sims = bootstrap_training_sims, bootstrap_validation_sims = bootstrap_validation_sims)
training_data <- rnorm(1e3, mean = 100, sd = 10) validation_data <- rnorm(1e3, mean = 100, sd = 10) bootstrap_size <- 1000 bootstrap_training_sims <- 10 bootstrap_validation_sims <- 10 probs <- c(1-1e-1, 1-0.5e-1, 1-1e-2) probs_interest <- c(1-1e-6, 1-1e-7) maxk_line <- c(100, 125, 150) estimated_quants <- RESTK(training_data = training_data, validation_data = validation_data, probs = probs, probs_interest = probs_interest, bootstrap_size = bootstrap_size, bootstrap_training_sims = bootstrap_training_sims, bootstrap_validation_sims = bootstrap_validation_sims)
RESTK_training
function used to project the maxk line into the probabilities of interest
RESTK_training( training_data = NULL, probs = NULL, probs_interest = NULL, bootstrap_size = NULL, bootstrap_training_sims = NULL )
RESTK_training( training_data = NULL, probs = NULL, probs_interest = NULL, bootstrap_size = NULL, bootstrap_training_sims = NULL )
training_data |
training data |
probs |
Probabilities where maxk was evaluated |
probs_interest |
Probabilities of interest to estimate |
bootstrap_size |
size of bootstrap simulations on the training data |
bootstrap_training_sims |
number of bootstrap simulations on the training data |
Returns the estimated maxk line from the probabilities of interest
training_data <- rnorm(1e3, mean = 100, sd = 10) probs <- c(1-1e-1, 1-0.5e-1, 1-1e-2) probs_interest <- c(1-1e-6, 1-1e-7) bootstrap_size <- 1000 bootstrap_training_sims <- 100 maxk_line <- RESTK_training(training_data = training_data, probs = probs, probs_interest = probs_interest, bootstrap_size = bootstrap_size, bootstrap_training_sims = bootstrap_training_sims)
training_data <- rnorm(1e3, mean = 100, sd = 10) probs <- c(1-1e-1, 1-0.5e-1, 1-1e-2) probs_interest <- c(1-1e-6, 1-1e-7) bootstrap_size <- 1000 bootstrap_training_sims <- 100 maxk_line <- RESTK_training(training_data = training_data, probs = probs, probs_interest = probs_interest, bootstrap_size = bootstrap_size, bootstrap_training_sims = bootstrap_training_sims)
RESTK_validation
main function for the validation of the RESTK methodology by using the maxk line
RESTK_validation( validation_data = NULL, maxk_line = NULL, probs_interest = NULL, bootstrap_size = NULL, bootstrap_validation_sims = NULL )
RESTK_validation( validation_data = NULL, maxk_line = NULL, probs_interest = NULL, bootstrap_size = NULL, bootstrap_validation_sims = NULL )
validation_data |
validation data |
maxk_line |
maxk line obtained from RESTK_training |
probs_interest |
Probabilities of interest to estimate |
bootstrap_size |
size of bootstrap simulations on the validation data |
bootstrap_validation_sims |
number of bootstrap simulations on the validation data |
Returns the estimated quantiles from the probabilities of interest
validation_data <- rnorm(1e3, mean = 100, sd = 10) probs_interest <- c(1-1e-6, 1-1e-7) bootstrap_size <- 1000 bootstrap_validation_sims <- 100 maxk_line <- c(100, 125, 150) estimated_quants <- RESTK_validation(validation_data = validation_data, maxk_line = maxk_line, probs_interest = probs_interest, bootstrap_size = bootstrap_size, bootstrap_validation_sims = bootstrap_validation_sims)
validation_data <- rnorm(1e3, mean = 100, sd = 10) probs_interest <- c(1-1e-6, 1-1e-7) bootstrap_size <- 1000 bootstrap_validation_sims <- 100 maxk_line <- c(100, 125, 150) estimated_quants <- RESTK_validation(validation_data = validation_data, maxk_line = maxk_line, probs_interest = probs_interest, bootstrap_size = bootstrap_size, bootstrap_validation_sims = bootstrap_validation_sims)
sample_quantile_estimation
returns the estimated quantiles for the chosen probabilities from the input sample.
This method uses the sample quantile method number 8 from the default quantile function.
sample_quantile_estimation(samp = NULL, probs = NULL, bootstrap_sims = NULL)
sample_quantile_estimation(samp = NULL, probs = NULL, bootstrap_sims = NULL)
samp |
Sample of data to model |
probs |
Probabilities of interest to generate the max_k line |
bootstrap_sims |
Number of bootstrap simulations to estimate the quantiles |
Returns estimated quantiles for the chosen probabilities.
samp <- rnorm(1e3, mean = 100, sd = 10) probs <- c(1-1e-1, 1-0.5e-1, 1-1e-2) bootstrap_training_sims <- 100 estimated_quantiles <- sample_quantile_estimation(samp = samp, probs = probs, bootstrap_sims = bootstrap_training_sims)
samp <- rnorm(1e3, mean = 100, sd = 10) probs <- c(1-1e-1, 1-0.5e-1, 1-1e-2) bootstrap_training_sims <- 100 estimated_quantiles <- sample_quantile_estimation(samp = samp, probs = probs, bootstrap_sims = bootstrap_training_sims)
tightness
function used to minimized the tightness as a function of the value of k
tightness(samp = NULL, prob = NULL, quant = NULL, k = NULL)
tightness(samp = NULL, prob = NULL, quant = NULL, k = NULL)
samp |
Sample of data to model |
prob |
Probability of interest |
quant |
Quantile of interest |
k |
value of k to check tightness |
Returns the squared difference between the tightness and 1
samp <- rnorm(1e3, mean = 100, sd = 10) prob <- c(1-1e-2) k <- 1:100 quant <- qnorm(p = prob, mean = 100, sd = 10) tightness(samp = samp, prob = prob, quant = quant, k = k)
samp <- rnorm(1e3, mean = 100, sd = 10) prob <- c(1-1e-2) k <- 1:100 quant <- qnorm(p = prob, mean = 100, sd = 10) tightness(samp = samp, prob = prob, quant = quant, k = k)