Skip to content

Commit

Permalink
fixing AMI computation (was always retunring 0), thanks to Florent Be…
Browse files Browse the repository at this point in the history
…rsani
  • Loading branch information
jchiquet committed Dec 14, 2022
1 parent ba32807 commit 17f85a5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
3 changes: 0 additions & 3 deletions CRAN-SUBMISSION

This file was deleted.

7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
Package: aricode
Type: Package
Title: Efficient Computations of Standard Clustering Comparison Measures
Version: 1.0.1
Version: 1.0.2
Authors@R: c(
person("Julien", "Chiquet", role = c("aut", "cre"), email = "[email protected]",
comment = c(ORCID = "0000-0002-3629-3429")),
person("Guillem", "Rigaill", role = "aut", email = "[email protected]"),
person("Martina", "Sundqvist", role = "aut", email = "[email protected]"),
person("Valentin", "Dervieux", role = "ctb", email = "[email protected]")
person("Valentin", "Dervieux", role = "ctb", email = "[email protected]"),
person("Florent", "Bersani", role = "ctb", email = "[email protected]")
)
Maintainer: Julien Chiquet <[email protected]>
Description: Implements an efficient O(n) algorithm based on bucket-sorting for
Expand All @@ -29,5 +30,5 @@ Suggests:
testthat,
spelling
LinkingTo: Rcpp
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Language: en-US
6 changes: 2 additions & 4 deletions R/aricode.R
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,7 @@ clustComp <- function(c1, c2) {
ID <- max(H$U, H$V) - MI
NID <- 1 - MI / max(H$U, H$V)
NMI <- MI / max(H$U, H$V)

EMI <- expected_MI(as.integer(H$ni.), as.integer(H$n.j))

EMI <- expected_MI(as.integer(H$sortPairs$ni.), as.integer(H$sortPairs$n.j))

res <- list(RI = RI(c1,c2) ,
ARI = ARI(c1,c2) ,
Expand Down Expand Up @@ -321,7 +319,7 @@ AMI <- function(c1, c2){

H <- entropy(c1,c2)
MI <- - H$UV + H$U + H$V
EMI <- expected_MI(as.integer(H$ni.), as.integer(H$n.j))
EMI <- expected_MI(as.integer(H$sortPairs$ni.), as.integer(H$sortPairs$n.j))

res <- (MI - EMI) / (max(H$U,H$V) - EMI)
res
Expand Down
11 changes: 5 additions & 6 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
This submission is in response to a request from a CRAN maintainer due to upcoming switch to HTML5 in documentation and error in USBAN check (due to bad use of R_Na with integer vector)
This submission follows the reporting of a bug in the calculation of the AMI.

## aricode 1.0.1
## aricode 1.0.2

- fix warnings in C++
- fix documentation for to comply with CRAN policy and HTML5 validation
- fix serious bug in computation of AMI, thanks to Florent Bersani

## Tested environments

Expand All @@ -25,8 +24,8 @@ all status OK

## Local R CMD check results

── R CMD check results ──────────────────────────────────────────────────────────────── aricode 1.0.1 ────
Duration: 33.4s
── R CMD check results ─────────────────────────────────────────────────────────────────────────────── aricode 1.0.2 ────
Duration: 22.8s

0 errors ✔ | 0 warnings ✔ | 0 notes ✔

Expand Down

0 comments on commit 17f85a5

Please sign in to comment.