
Profile Difference Calculation for Change Detection
Source:R/ProfileDifference.R
ProfileDifference.RdImplements 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.
Details
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.
References
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.
Public fields
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.
Methods
Method new()
Initializes the ProfileDifference class.
Usage
ProfileDifference$new(
method = "pdi",
deriv = "gold",
gold_spline = TRUE,
gold_embedding = 4,
nderiv = 4,
gold_spline_threshold = 0.01,
epsilon = NULL
)Arguments
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.
Examples
set.seed(123)
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("Method:", result$method)
#> Method:pdi
message("Distance:", round(result$distance, 4))
#> Distance:0.0309