-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function agf #37
Comments
Hello, @Koumougilles How are you? Thanks for your inquiry. Yet I don't have a clear picture where the error is. In summary, do you mean that what Maratea el al (2014) proposed is misleading? If so, is there another paper demonstrating an undesired behaviour of the AGF ? Is there an alternative/improved equation that fixes what you think is incorrect so I can correct the formula or add a new index? I would appreciate if you could provide an alternative formula from a paper. At some point, all indices present limitations, and that's how new and refined indices/metrics have been developed over time. Thank you very much for your inquiry! Best regards, |
Hi @adriancorrendo, I think you miunderstand the definition in the paper of Maratea et al (2014). The authors write just after the formula of AGF: Your AGF uses recall and precision which is defined with only 3 elements of the confusion matrix: 1-TP (true positive) In their paper, the authors precise that invF05 by applied the F score formula to the inverse of the confusion matrix obtained by switching the class labels of each sample (positive samples Thank you! |
Hi @adriancorrendo, I wrote to Maratea et al (2014). This is my message: _Dear authors, I hope that you are doing well. I am Gilles Koumou. I am interested by your measure Adjusted-F. The measure is available in an R package named metrica. However, I think that the function of Adjusted-F in this package is not exact. In your paper you did not give an explicit formulation of your inverse F score InvF_0.5. I think that it depend on specificity and negative predictive value. If I am right could you please give me the exact formulation or confirm my following formulation: InvF_0.5=(1+0.5^2)((npvspec)/(0.5^2npv+spec)) où npv=negative predictive value Thank you_ This is the answer of the corresponding author Antonio Maratea: Dear Gilles, So the correct formulation of InvF0.5 is I transfer these emails to you. Thank you! |
Hi Gilles, How are you? I had some time available so I already updated the Agf formula on the "master" branch. I mentioned you in an acknowledgment in the NEWS.md document. Would you mind checking the new agf() out? You will need to install the package from GitHub instead of CRAN. There is another new metric added called P4. Once receiving your confirmation I will close this issue and upload the new version to CRAN. Thank you for your contribution! Best |
Hi Adrian
Well received. I will check the function agf() next week and give you feedbacks.
Best regards.
Obtenir Outlook pour Android<https://aka.ms/AAb9ysg>
…________________________________
From: Adrian A. Correndo ***@***.***>
Sent: Sunday, March 24, 2024 6:36:13 PM
To: adriancorrendo/metrica ***@***.***>
Cc: Nettey Boevi Gilles Koumou ***@***.***>; Mention ***@***.***>
Subject: Re: [adriancorrendo/metrica] function agf (Issue #37)
Hi Gilles,
How are you?
I had some time available so I already updated the Agf formula on the "master" branch. I mentioned you in an acknowledgment in the NEWS.md document. Would you mind checking the new agf() out? You will need to install the package from GitHub instead of CRAN. There is another new metric added called P4.
Once receiving your confirmation I will close this issue and upload the new version to CRAN.
Thank you for your contribution!
Best
Adrian
—
Reply to this email directly, view it on GitHub<#37 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BG7GL7UIV4TEUDMSCHWLX43YZ5IN3AVCNFSM6AAAAABEW5T4COVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJWHE3TAMJZHA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hi, Gilles How are you? Thanks, |
Hi Adrian, I check you function agf (): #' @title Adjusted F-score matrix <- rlang::eval_tidy( If binomialif (nrow(matrix) == 2){
} If multinomialif (nrow(matrix) >2) {
} Formula componentsF2 <- 5 * ( (recprec) / ((4rec) + prec) ) agf <- sqrt(F2 * invF05) if (tidy==TRUE){ if (tidy==FALSE){ There is an error in your F2: F2 must be F2 <- 5 * ( (recprec) / ((4prec) + rec) ) Thanks. |
Hi @adriancorrendo,
It is Gilles Koumou. I thing that there is an error in the function agf designed to compute the Adjusted F-measure.
This is the function:
function (data = NULL, obs, pred, pos_level = 2, atom = FALSE,
tidy = FALSE, na.rm = TRUE)
{
matrix <- rlang::eval_tidy(data = data, rlang::quo(table({
{
pred
}
}, {
{
obs
}
})))
if (nrow(matrix) == 2) {
if (pos_level == 1) {
TP <- matrix[[1]]
TPFP <- matrix[[1]] + matrix[[3]]
TPFN <- matrix[[1]] + matrix[[2]]
TN <- matrix[[4]]
N <- matrix[[4]] + matrix[[3]]
}
if (pos_level == 2) {
TP <- matrix[[4]]
TPFP <- matrix[[4]] + matrix[[2]]
TPFN <- matrix[[4]] + matrix[[3]]
TN <- matrix[[1]]
N <- matrix[[1]] + matrix[[2]]
}
rec <- TP/(TPFN)
prec <- TP/(TPFP)
}
if (nrow(matrix) > 2) {
correct <- diag(matrix)
total_actual <- colSums(matrix)
total_pred <- rowSums(matrix)
TP <- diag(matrix)
TPFP <- rowSums(matrix)
TPFN <- colSums(matrix)
TN <- sum(matrix) - (TPFP + TPFN - TP)
FP <- TPFP - TP
if (atom == FALSE) {
prec <- mean(correct/total_pred)
rec <- mean(correct/total_actual)
warning("For multiclass cases, the agf should be estimated at a class level. Please, consider using
atom = TRUE
")}
if (atom == TRUE) {
prec <- correct/total_pred
rec <- correct/total_actual
}
}
F2 <- 5 * ((rec * prec)/((4 * rec) + prec))
invF05 <- (5/4) * ((rec * prec)/(((0.5^2) * rec) + prec))
agf <- sqrt(F2 * invF05)
if (tidy == TRUE) {
return(as.data.frame(agf))
}
if (tidy == FALSE) {
return(list(agf = agf))
}
}
<bytecode: 0x000001283191fe68>
<environment: namespace:metrica>
The error is about invF05. In my opinion invF05 is related to specificity and negative predictive value.
Thanks!
The text was updated successfully, but these errors were encountered: