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.
method
The method used for profile difference calculation.
deriv
The method used for derivative calculation.
gold_spline
Boolean indicating if cubic spline should be used in gold method.
gold_embedding
Embedding dimension for gold method.
nderiv
Order of the derivative for simple method.
gold_spline_threshold
Threshold for cubic spline in gold method.
epsilon
Small value to avoid numerical issues.
profile1
The first profile.
profile2
The 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 )
method
The method used for profile difference calculation.
deriv
The method used for derivative calculation.
gold_spline
Boolean indicating if cubic spline should be used in gold method.
gold_embedding
Embedding dimension for gold method.
nderiv
Order of the derivative for simple method.
gold_spline_threshold
Threshold for cubic spline in gold method.
epsilon
Small 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)
profile1
The first profile.
profile2
The 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)
deep
Whether 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.