| ProfileDifference | R Documentation |
Implements the calculation of profile differences using various methods such as PDI, L2, and L2 derivative. The class provides methods for setting profiles and calculating the differences.
The class supports multiple methods for calculating profile differences, including the Profile Disparity Index (PDI) using gold or simple derivative methods, and L2 norm and L2 derivative calculations. It allows for customization of various parameters such as embedding dimensions, derivative orders, and thresholds.
methodThe method used for profile difference calculation.
derivThe method used for derivative calculation.
gold_splineBoolean indicating if cubic spline should be used in gold method.
gold_embeddingEmbedding dimension for gold method.
nderivOrder of the derivative for simple method.
gold_spline_thresholdThreshold for cubic spline in gold method.
epsilonSmall value to avoid numerical issues.
profile1The first profile.
profile2The second profile.
new()Initializes the ProfileDifference class.
ProfileDifference$new( method = "pdi", deriv = "gold", gold_spline = TRUE, gold_embedding = 4, nderiv = 4, gold_spline_threshold = 0.01, epsilon = NULL )
methodThe method used for profile difference calculation.
derivThe method used for derivative calculation.
gold_splineBoolean indicating if cubic spline should be used in gold method.
gold_embeddingEmbedding dimension for gold method.
nderivOrder of the derivative for simple method.
gold_spline_thresholdThreshold for cubic spline in gold method.
epsilonSmall value to avoid numerical issues.
reset()Resets the internal state of the detector.
ProfileDifference$reset()
set_profiles()Sets the profiles for comparison.
ProfileDifference$set_profiles(profile1, profile2)
profile1The first profile.
profile2The second profile.
calculate_difference()Calculates the difference between the profiles.
ProfileDifference$calculate_difference()
A list containing the method details and the calculated distance.
clone()The objects of this class are cloneable with this method.
ProfileDifference$clone(deep = FALSE)
deepWhether to make a deep clone.
Kobylińska, K., Krzyziński, M., Machowicz, R., Adamek, M., & Biecek, P. (2023). Exploration of the Rashomon Set Assists Trustworthy Explanations for Medical Data. arXiv e-prints, arXiv-2308.
set.seed(123) # Setting a seed for reproducibility
profile1 <- list(x = 1:100, y = sin(1:100))
profile2 <- list(x = 1:100, y = sin(1:100) + rnorm(100, 0, 0.1))
pd <- ProfileDifference$new(method = "pdi", deriv = "gold")
pd$set_profiles(profile1, profile2)
result <- pd$calculate_difference()
message(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.