Skip to content

Commit

Permalink
Merge pull request #14 from tanaylab/feat@parallel
Browse files Browse the repository at this point in the history
Added parallelism
Changed the default to id_column = FALSE
  • Loading branch information
aviezerl committed Dec 26, 2023
2 parents d4cd945 + 5f89c67 commit 50188ca
Show file tree
Hide file tree
Showing 33 changed files with 507 additions and 255 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@
^cran-comments\.md$
^CRAN-SUBMISSION$
^\.github$
^work$
^\.vscode$
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ README.html
/doc/
/Meta/
src/symbols.rds
work
.vscode
54 changes: 32 additions & 22 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,36 +1,42 @@
Package: tglkmeans
Title: Efficient Implementation of K-Means++ Algorithm
Version: 0.3.12
Authors@R:
c(person(given = "Aviezer",
family = "Lifshitz",
role = c("aut", "cre"),
email = "[email protected]"),
person(given = "Amos",
family = "Tanay",
role = "aut"),
person("Weizmann Institute of Science", role="cph"))
Author: Aviezer Lifshitz [aut, cre], Amos Tanay [aut], Weizmann Institute of Science [cph]
Version: 0.4.0
Authors@R: c(
person("Aviezer", "Lifshitz", , "[email protected]", role = c("aut", "cre")),
person("Amos", "Tanay", role = "aut"),
person("Weizmann Institute of Science", role = "cph")
)
Author: Aviezer Lifshitz [aut, cre], Amos Tanay [aut], Weizmann Institute
of Science [cph]
Maintainer: Aviezer Lifshitz <[email protected]>
Description: Efficient implementation of K-Means++ algorithm. For more information see (1) "kmeans++ the advantages of the k-means++ algorithm" by David Arthur and Sergei Vassilvitskii (2007), Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete algorithms, Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, pp. 1027-1035, and (2) "The Effectiveness of Lloyd-Type Methods for the k-Means Problem" by Rafail Ostrovsky, Yuval Rabani, Leonard J. Schulman and Chaitanya Swamy <doi:10.1145/2395116.2395117>.
Description: Efficient implementation of K-Means++ algorithm. For more
information see (1) "kmeans++ the advantages of the k-means++
algorithm" by David Arthur and Sergei Vassilvitskii (2007),
Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete
algorithms, Society for Industrial and Applied Mathematics,
Philadelphia, PA, USA, pp. 1027-1035, and (2) "The Effectiveness of
Lloyd-Type Methods for the k-Means Problem" by Rafail Ostrovsky, Yuval
Rabani, Leonard J. Schulman and Chaitanya Swamy
<doi:10.1145/2395116.2395117>.
License: MIT + file LICENSE
BugReports: https://github.com/tanaylab/tglkmeans/issues
URL: https://tanaylab.github.io/tglkmeans/, https://github.com/tanaylab/tglkmeans
OS_type: unix
Depends:
R (>= 4.0.0)
Imports:
Rcpp (>= 0.12.11),
cli,
doFuture,
dplyr (>= 0.5.0),
future,
dplyr (>= 0.5.0),
ggplot2 (>= 2.2.0),
ggplot2 (>= 2.2.0),
magrittr,
tibble (>= 3.2.1),
parallel (>= 3.3.2),
parallel (>= 3.3.2),
plyr (>= 1.8.4),
purrr (>= 0.2.0),
tgstat (>= 1.0.0)
purrr (>= 0.2.0),
Rcpp (>= 0.12.11),
RcppParallel,
tgstat (>= 1.0.0),
tibble (>= 3.2.1)
Suggests:
covr,
knitr,
Expand All @@ -39,10 +45,14 @@ Suggests:
testthat,
withr
LinkingTo:
Rcpp
Rcpp,
RcppParallel
VignetteBuilder:
knitr
Config/testthat/edition: 3
Config/testthat/parallel: false
Encoding: UTF-8
NeedsCompilation: yes
Packaged: 2018-02-25 13:32:32 UTC; aviezerl
OS_type: unix
RoxygenNote: 7.2.3
SystemRequirements: GNU make
6 changes: 6 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ export(tglkmeans.set_parallel)
import(dplyr)
import(ggplot2)
importFrom(Rcpp,sourceCpp)
importFrom(RcppParallel,RcppParallelLibs)
importFrom(cli,cli_abort)
importFrom(cli,cli_alert)
importFrom(cli,cli_alert_info)
importFrom(cli,cli_alert_success)
importFrom(cli,cli_warn)
importFrom(grDevices,colorRampPalette)
importFrom(grDevices,dev.off)
importFrom(magrittr,"%>%")
Expand Down
12 changes: 9 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
# tglkmeans 0.4.0

* Default of `id_column` parameter was changed to `FALSE`. Note that this is a breaking change, and if you want to use an id column, you need to set it explicitly to `TRUE`.
* Use R random number generator instead of C++11 random number generator. For backwards compatibility, the old random number generator can be used by setting `use_cpp_random` to `TRUE`.
* Added parallelization using `RcppParallel`.

# tglkmeans 0.3.12

* Added validity checks for `k` and the number of observations.

# tgkmeans 0.3.11
# tglkmeans 0.3.11

* Changed pkgdoc, see: https://github.com/r-lib/roxygen2/issues/1491.

# tgkmeans 0.3.10
# tglkmeans 0.3.10

* Removed broken link to one of the references in the description.

# tgkmeans 0.3.9
# tglkmeans 0.3.9

* Remove empty clusters. This may happen when the number of clusters is larger than the number of observations, and currently caused an error in the reordering step.

Expand Down
4 changes: 2 additions & 2 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ reduce_num_trials <- function(boot_nodes_l, cc_mat) {
invisible(.Call('_tglkmeans_reduce_num_trials', PACKAGE = 'tglkmeans', boot_nodes_l, cc_mat))
}

TGL_kmeans_cpp <- function(ids, mat, k, metric, max_iter = 40, min_delta = 0.0001, random_seed = TRUE, seed = -1L) {
.Call('_tglkmeans_TGL_kmeans_cpp', PACKAGE = 'tglkmeans', ids, mat, k, metric, max_iter, min_delta, random_seed, seed)
TGL_kmeans_cpp <- function(ids, mat, k, metric, max_iter = 40, min_delta = 0.0001, use_cpp_random = FALSE, seed = -1L) {
.Call('_tglkmeans_TGL_kmeans_cpp', PACKAGE = 'tglkmeans', ids, mat, k, metric, max_iter, min_delta, use_cpp_random, seed)
}

Loading

0 comments on commit 50188ca

Please sign in to comment.