diff --git a/DESCRIPTION b/DESCRIPTION index 96b2712..f1ebdcc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,10 +1,10 @@ Package: CEC Title: Cross-Entropy Clustering Version: 0.10.3 -Date: 2021-09-17 +Date: 2021-09-20 Author: Konrad Kamieniecki [aut, cre], Przemyslaw Spurek [ctb] Maintainer: Konrad Kamieniecki -Description: CEC divides data into Gaussian type clusters. The implementation allows the simultaneous use of various type Gaussian mixture models, performs the reduction of unnecessary clusters and it's able to discover new groups. Based on Spurek, P. and Tabor, J. (2014) . +Description: Clustering that splits data into Gaussian type clusters. The implementation allows the simultaneous use of various type Gaussian mixture models, performs the reduction of unnecessary clusters and it's able to discover new groups. Based on Spurek, P. and Tabor, J. (2014) . ByteCompile: true URL: https://github.com/azureblue/cec Encoding: UTF-8 @@ -12,3 +12,4 @@ NeedsCompilation: yes SystemRequirements: C++11 License: GPL-3 Imports: graphics, methods, stats, utils +Packaged: 2021-09-20 21:50:01 UTC; konrad diff --git a/R/cec.R b/R/cec.R index 8e2ce70..2313ea8 100644 --- a/R/cec.R +++ b/R/cec.R @@ -7,15 +7,15 @@ cec <- function( param, centers.init = c("kmeans++", "random"), card.min = "5%", - keep.removed = F, - interactive = F, + keep.removed = FALSE, + interactive = FALSE, threads = 1, - split = F, + split = FALSE, split.depth = 8, split.tries = 5, split.limit = 100, split.initial.starts = 1, - readline = T + readline = TRUE ) { # check arguments @@ -207,13 +207,14 @@ cec.interactive <- function( param, centers.init = c("kmeans++", "random"), card.min = "5%", - keep.removed = F, - readline = T + keep.removed = FALSE, + readline = TRUE ) { par { old.ask = par()["ask"] + on.exit(par(old.ask)) n = ncol(x) if (n != 2) stop("interactive mode available only for 2-dimensional data") @@ -261,7 +262,6 @@ cec.interactive <- function( i = i + 1 } plot(Z, ellipses="TRUE") - par(ask = old.ask) if (readline) ignore = readline(prompt="Press :") diff --git a/R/plot.cec.R b/R/plot.cec.R index e20003e..dbc73d9 100644 --- a/R/plot.cec.R +++ b/R/plot.cec.R @@ -1,4 +1,4 @@ -plot.cec <- function(x, col, cex = 0.5, pch = 19, cex.centers = 1, pch.centers = 8, ellipses.lwd = 4, ellipses = TRUE, model = T, xlab, ylab, ...) +plot.cec <- function(x, col, cex = 0.5, pch = 19, cex.centers = 1, pch.centers = 8, ellipses.lwd = 4, ellipses = TRUE, model = TRUE, xlab, ylab, ...) { if (ncol (x $ data) != 2 ) stop("plotting available only for 2-dimensional data") @@ -45,4 +45,4 @@ plot.cec <- function(x, col, cex = 0.5, pch = 19, cex.centers = 1, pch.centers = finally = {}) } } -} \ No newline at end of file +} diff --git a/man/CEC-package.Rd b/man/CEC-package.Rd index 1581733..9db2bed 100644 --- a/man/CEC-package.Rd +++ b/man/CEC-package.Rd @@ -22,4 +22,12 @@ Konrad Kamieniecki \seealso{ \code{\link{cec}} } -\keyword{ clustering, entropy, gaussian, kmeans } + +\keyword{cluster} +\keyword{models} +\keyword{multivariate} +\keyword{package} +\concept{entropy} +\concept{gaussian} +\concept{gaussian mixture models} +\concept{kmeans} diff --git a/man/ball.Rd b/man/ball.Rd index 0170d76..fc2918b 100644 --- a/man/ball.Rd +++ b/man/ball.Rd @@ -41,6 +41,4 @@ M = ball(4000, 0.9) plot(M, cex = 0.5, pch = 19) } -\keyword{ ~ball } -\keyword{ ~points } -\keyword{ ~uniform } +\keyword{datagen} diff --git a/man/cec.Rd b/man/cec.Rd index a08906e..b2ff489 100644 --- a/man/cec.Rd +++ b/man/cec.Rd @@ -12,9 +12,9 @@ Performs Cross-Entropy Clustering on a data matrix. \usage{ cec(x, centers, type = c("covariance", "fixedr", "spherical", "diagonal", "eigenvalues", "mean", "all"), iter.max = 25, nstart = 1, param, -centers.init = c("kmeans++", "random"), card.min = "5\%", keep.removed = F, -interactive = F, threads = 1, split = F, split.depth = 8, split.tries = 5, -split.limit = 100, split.initial.starts = 1,readline = T) +centers.init = c("kmeans++", "random"), card.min = "5\%", keep.removed = FALSE, +interactive = FALSE, threads = 1, split = FALSE, split.depth = 8, split.tries = 5, +split.limit = 100, split.initial.starts = 1, readline = TRUE) } \arguments{ @@ -56,7 +56,7 @@ only if the \code{centers} argument is a number or a vector. If the \code{centers} argument is a vector, \code{length(centers)} clusterings will be performed for each start and the total number of clusterings will be \code{length(centers) * nstart}. -If the split mode is on (\code{split = T}), it's rarely desired use change this parameter as the whole procedure (initial clustering + split) will be performed \code{nstart} times. +If the split mode is on (\code{split = TRUE}), it's rarely desired use change this parameter as the whole procedure (initial clustering + split) will be performed \code{nstart} times. } \item{centers.init}{ @@ -182,7 +182,8 @@ m2 = matrix(rnorm(2000, mean = 3, sd = 1.5), ncol = 2) m3 = matrix(rnorm(2000, mean = 3, sd = 1), ncol = 2) m3[,2] = m3[,2] - 5 m = rbind(m1, m2, m3) -par(ask = TRUE) +oldpar = par(ask = TRUE) +on.exit(par(oldpar)) plot(m, cex = 0.5, pch = 19) ## Clustering result: Z = cec(m, 10, iter.max = 100, card.min="7\%") @@ -223,5 +224,13 @@ Spurek, P. and Tabor, J. (2014) Cross-Entropy Clustering \emph{Pattern Recognition} \bold{47, 9} 3046--3059 } -\keyword{ ~cec } -\keyword{ ~clustering } + +\keyword{cluster} +\keyword{models} +\keyword{multivariate} +\keyword{package} +\concept{entropy} +\concept{gaussian} +\concept{gaussian mixture models} +\concept{kmeans} + diff --git a/man/mouseset.Rd b/man/mouseset.Rd index a5fc1ec..c60e057 100644 --- a/man/mouseset.Rd +++ b/man/mouseset.Rd @@ -59,7 +59,4 @@ right.ear.dist=2.5, dim=2) plot(M, cex = 0.5, pch = 19) } -\keyword{ ~mouse} -\keyword{ ~mouseset} -\keyword{ ~points} -\keyword{ ~uniform} +\keyword{datagen} diff --git a/man/plot.cec.Rd b/man/plot.cec.Rd index 8bfa3de..559647e 100644 --- a/man/plot.cec.Rd +++ b/man/plot.cec.Rd @@ -13,7 +13,7 @@ Ellipses are drawn with regards to the covariance (either model or sample) of ea \usage{ \method{plot}{cec}(x, col, cex = 0.5, pch = 19, cex.centers = 1, pch.centers = 8, -ellipses.lwd = 4, ellipses = TRUE, model = T, xlab, ylab, ...) +ellipses.lwd = 4, ellipses = TRUE, model = TRUE, xlab, ylab, ...) } \arguments{ @@ -67,6 +67,8 @@ Arguments are passed to \code{plot} function when drawing data points. } } +\value{No return value.} + \seealso{ \code{\link{print.cec}} } @@ -75,5 +77,5 @@ Arguments are passed to \code{plot} function when drawing data points. ## See the examples of function cec. } -\keyword{ ~plot } -\keyword{ ~cec } +\keyword{hplot} + diff --git a/man/print.cec.Rd b/man/print.cec.Rd index 74af0f5..07b1b13 100644 --- a/man/print.cec.Rd +++ b/man/print.cec.Rd @@ -24,6 +24,8 @@ Ignored. } } +\value{Returns the summary of the \code{cec} function result as text.} + \seealso{ \code{\link{plot.cec}} } @@ -31,6 +33,3 @@ Ignored. \examples{ ## See the examples of function cec. } - -\keyword{ ~print } -\keyword{ ~cec } diff --git a/man/run.cec.tests.Rd b/man/run.cec.tests.Rd index 7fa02cd..b823b7e 100644 --- a/man/run.cec.tests.Rd +++ b/man/run.cec.tests.Rd @@ -14,6 +14,5 @@ defining each test case. This is also used for R CMD check. run.cec.tests() } -\keyword{ ~tests } -\keyword{ ~unit } -\keyword{ ~cec } +\value{No return value. Stops with error when a test fails.} +\concept{unit testing}