Skip to content

Commit 0a87e01

Browse files
author
Keefe-Murphy
committed
A warning message is now printed if the MLR in the gating network (only once, for any EM iteration of any model) fails to converge in itmax[3] iterations. The default value of itmax[3] has been increased from 100L to 1000L. This is liable to slow down the internal calls to nnet::multinom, but it generally reduces the required number of EM iterations. Minor .version_above() and ifelse fixes. More minor vignette edits. g.itmax now passed to glm(). Minor speedup to MoE_mahala for univariate data. CRAN release.
1 parent ffe59d2 commit 0a87e01

14 files changed

+127
-93
lines changed

DESCRIPTION

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: MoEClust
22
Type: Package
3-
Date: 2020-12-29
3+
Date: 2021-06-21
44
Title: Gaussian Parsimonious Clustering Models with Covariates and a Noise Component
5-
Version: 1.3.3
5+
Version: 1.4.0
66
Authors@R: c(person("Keefe", "Murphy", email = "keefe.murphy@mu.ie", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7709-3159")),
77
person("Thomas Brendan", "Murphy", email = "brendan.murphy@ucd.ie", role = "ctb", comment = c(ORCID = "0000-0002-5668-7046")))
88
Description: Clustering via parsimonious Gaussian Mixtures of Experts using the MoEClust models introduced by Murphy and Murphy (2020) <doi:10.1007/s11634-019-00373-8>. This package fits finite Gaussian mixture models with a formula interface for supplying gating and/or expert network covariates using a range of parsimonious covariance parameterisations from the GPCM family via the EM/CEM algorithm. Visualisation of the results of such models using generalised pairs plots and the inclusion of an additional noise component is also facilitated. A greedy forward stepwise search algorithm is provided for identifying the optimal model in terms of the number of components, the GPCM covariance parameterisation, and the subsets of gating/expert network covariates.
@@ -17,10 +17,10 @@ Imports:
1717
matrixStats (>= 0.53.1),
1818
mclust (>= 5.4),
1919
mvnfast,
20-
nnet,
20+
nnet (>= 7.3-0),
2121
vcd
2222
Suggests:
23-
cluster,
23+
cluster (>= 1.4.0),
2424
clustMD (>= 1.2.1),
2525
geometry (>= 0.4.0),
2626
knitr,

R/Functions.R

Lines changed: 64 additions & 48 deletions
Large diffs are not rendered by default.

R/MoEClust.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
#' \itemize{
2525
#' \item{Type: }{Package}
2626
#' \item{Package: }{MoEClust}
27-
#' \item{Version: }{1.3.3}
28-
#' \item{Date: }{2020-12-29 (this version), 2017-11-28 (original release)}
27+
#' \item{Version: }{1.4.0}
28+
#' \item{Date: }{2021-06-21 (this version), 2017-11-28 (original release)}
2929
#' \item{Licence: }{GPL (>=2)}
3030
#' }
3131
#'
@@ -42,9 +42,9 @@
4242
#' \donttest{data(ais)
4343
#'
4444
#' # Fit two sets of models
45-
#' res1 <- MoE_clust(ais[,3:7], G=2, gating=~BMI, expert=~sex,
45+
#' res1 <- MoE_clust(ais[,3:7], G=2, gating= ~ BMI, expert= ~ sex,
4646
#' modelNames=c("VEE", "EVE", "VVE"), network.data=ais)
47-
#' res2 <- MoE_clust(ais[,3:7], G=2, equalPro=TRUE, expert=~sex,
47+
#' res2 <- MoE_clust(ais[,3:7], G=2, equalPro=TRUE, expert= ~ sex,
4848
#' modelNames=c("VEE", "EVE", "VVE"), network.data=ais)
4949
#'
5050
#' # Compare the best model from each set of results
@@ -89,7 +89,7 @@
8989
version <- read.dcf(path, "Version")
9090
name <- read.dcf(path, "Package")
9191
if(interactive()) {
92-
packageStartupMessage(paste("\n___ ___ _____ _____ _ _ \n| \\/ | | ___/ __ \\ | | | Gaussian Parsimonious \n| . . | ___ | |__ | / \\/ |_ _ ___| |_ Clustering Models with\n| |\\/| |/ _ \\| __|| | | | | | / __| __| Covariates and a\n| | | | (_) | |___| \\__/\\ | |_| \\__ \\ |_ Noise Component\n\\_| |_/\\___/\\____/ \\____/_|\\__,_|___/\\__| version", version, "\n"))
92+
packageStartupMessage(paste("\n___ ___ _____ _____ _ _ \n| \\/ | | ___/ __ \\ | | | Gaussian Parsimonious \n| . . | ___ | |__ | / \\/ |_ _ ___| |_ Clustering Models with\n| |\\/| |/ _ \\| __|| | | | | | / __| __|\t Covariates and a\n| | | | (_) | |___| \\__/\\ | |_| \\__ \\ |_\t Noise Component\n\\_| |_/\\___/\\____/ \\____/_|\\__,_|___/\\__|\t version", version, "\n"))
9393
} else {
9494
packageStartupMessage("\nPackage ", sQuote(name), " version ", version, ".\n")
9595
}

R/Plotting_Functions.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
#' # Use barcode plots for the categorical/continuous pairs.
162162
#' # Magnify the size of scatter points assigned to the noise component.
163163
#'
164-
#' resN <- MoE_clust(ais[,3:7], G=2, gating=~SSF + Ht, expert=~sex,
164+
#' resN <- MoE_clust(ais[,3:7], G=2, gating= ~ SSF + Ht, expert= ~ sex,
165165
#' network.data=ais, modelNames="EEE", tau0=0.1, noise.gate=FALSE)
166166
#'
167167
#' MoE_gpairs(resN, data.ind=c(1,2,5), cov.ind=c(3,1,2),
@@ -195,7 +195,7 @@ MoE_gpairs.MoEClust <- function(res, response.type = c("points", "uncertainty",
195195
gate <- setdiff(attr(net, "Gating"), both)
196196
expx <- setdiff(attr(net, "Expert"), both)
197197
if(is.null(subset$show.map)) {
198-
subset$show.map <- ifelse(length(unique(claSS)) == 1, FALSE, (G + !is.na(res$hypvol)) > 1)
198+
subset$show.map <- (length(unique(claSS)) != 1) && ((G + !is.na(res$hypvol) > 1))
199199
} else {
200200
if(length(subset$show.map) > 1 ||
201201
!is.logical(subset$show.map)) stop("'subset$show.map' should be a single logical indicator", call.=FALSE)
@@ -316,7 +316,7 @@ MoE_gpairs.MoEClust <- function(res, response.type = c("points", "uncertainty",
316316
} else stop("'outer.margins' are not valid", call.=FALSE)
317317
}
318318
if(is.null(outer.labels)) {
319-
lab1 <- switch(EXPR=names(x)[1L], MAP=1L, ifelse(res$d == 1, 1L, 2L))
319+
lab1 <- switch(EXPR=names(x)[1L], MAP=1L, as.integer(res$d != 1) + 1L)
320320
lab2 <- switch(EXPR=names(x)[1L], MAP=2L, 1L)
321321
outer.labels$top <- vector("logical", N)
322322
outer.labels$top[seq(lab1, N, by=2)] <- TRUE
@@ -1529,7 +1529,7 @@ plot.MoEClust <- function(x, what=c("gpairs", "gating", "criterion", "loglik", "
15291529
}
15301530
width <- box.width
15311531
y.fix <- y - origin
1532-
fix.y <- ifelse(!identical(show.counts, FALSE), 80, 90)
1532+
fix.y <- ifelse(!isFALSE(show.counts), 80, 90)
15331533
y.fix <- if(max(y.fix) > fix.y) (y.fix * fix.y)/max(y.fix) else y.fix
15341534
if(reference) panel.abline(h=origin, col=reference.line$col, lty=reference.line$lty, lwd=reference.line$lwd, identifier=paste(identifier, "abline", sep="."))
15351535
panel.rect(x=x, y=rep(origin, length(x)), col=col, border=border, lty=lty, lwd=lwd, width=rep(width, length(x)), height=y.fix, just=c("centre", "bottom"), identifier=identifier)

inst/NEWS.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ __with Gating and Expert Network Covariates__
55
__and a Noise Component__
66
=======================================================
77

8+
## MoEClust v1.4.0 - (_12<sup>th</sup> release [minor update]: 2021-06-21_)
89
### New Features, Improvements, Big Fixes, & Miscellaneous Edits
910
* Various edits to `MoE_stepwise()` (thanks, in part, to requests from Dr. Konstantinos Perrakis):
1011
* Added `initialModel` arg. for specifying an initial model from which to begin the search,
@@ -39,12 +40,18 @@ __and a Noise Component__
3940
* `expert_covar` gains the arg. `weighted` to ensure cluster membership probabilities are properly
4041
accounted for in estimating the extra variability due to the component means: defaults to `TRUE`,
4142
but `weighted=FALSE` is provided as an option for recovering the old (not recommended) behaviour.
43+
* A warning message is now printed if the MLR in the gating network ever fails to converge,
44+
prompting the user to modify the `itmax` arg. to `MoE_control`: the 3<sup>rd</sup> element of this arg. governs
45+
the maximum number of MLR iterations --- consequently, its default has been modified from `100` to
46+
`1000` (thanks to a prompt from Dr. Georgios Karagiannis), which has the effect of slowing down
47+
internal calls to `nnet::multinom` but generally reduces the required number of EM iterations.
4248
* Minor fix to `MoE_compare` whenever the optimal model needs to be refitted.
4349
* Fixed conflict between `mclust::as.Mclust` & `MoEClust::as.Mclust`:
4450
`as.Mclust.MoEClust` now works regardless of order in which `mclust` & `MoEClust` are loaded.
4551
* Stronger checks for variables in `gating` & `expert` formulas which are not found in `network.data`.
52+
* Minor speed-up to initialisation for univariate response data with expert network covariates.
4653
* Minor speed-ups to some other utility functions.
47-
* Minor documentation and vignette edits.
54+
* Minor documentation, vignette, and vignette styling edits.
4855

4956
## MoEClust v1.3.3 - (_11<sup>th</sup> release [patch update]: 2020-12-29_)
5057
### New Features, Improvements, Bug Fixes, & Miscellaneous Edits
@@ -75,7 +82,7 @@ __and a Noise Component__
7582
* Package startup message now checks if newer version of package is available from CRAN.
7683
* Updated citation info after publication in _Advances in Data Analysis and Classification_.
7784
* Updated maintainer e-mail address.
78-
* Minor documentation, examples, and CRAN compliance + `mclust` compatability edits.
85+
* Minor documentation, examples, and CRAN compliance + `mclust` compatibility edits.
7986

8087
## MoEClust v1.3.1 - (_9<sup>th</sup> release [patch update]: 2020-05-12_)
8188
### New Features, Improvements, Bug Fixes, & Miscellaneous Edits
@@ -94,7 +101,7 @@ __and a Noise Component__
94101
* `MoE_mahala` now correctly uses the covariance of `resids` rather than the response.
95102
* New `MoE_mahala` arg. `identity` allow use of Euclidean distance instead:
96103
this argument can also be passed via `exp.init$identity` to `MoE_control`.
97-
* Convergence of the initialisation procedure now explictly monitored & sped-up.
104+
* Convergence of the initialisation procedure now explicitly monitored & sped-up.
98105
* Values of the criterion being minimised are now returned as an attribute.
99106
* The number of iterations of the initialisation algorithm are also returned as an attribute.
100107
* `MoE_control` arg. `exp.init$max.init` now defaults to `.Machine$integer.max`.
@@ -263,7 +270,7 @@ __and a Noise Component__
263270
* Final `linf` estimate now returned for optimal model when `stopping="aitken"` & G > 1.
264271
* Removed redundant extra M-step after convergence for models without expert covariates.
265272
* Removed redundant & erroneous `resid` & `residuals` args. to `as.Mclust` & `MoE_gpairs`.
266-
* `MoE_plotCrit`, `MoE_plotGate` & `MoE_plotLogLik` now invisibly return revelant quantities.
273+
* `MoE_plotCrit`, `MoE_plotGate` & `MoE_plotLogLik` now invisibly return relevant quantities.
267274
* Corrected degrees of freedom calculation for `G=0` models when `noise.init` is not supplied.
268275
* Fixed `drop_levels` to handle alphanumeric variable names and ordinal variables.
269276
* Fixed `MoE_compare` when a mix of models with and without a noise component are supplied.

man/MoEClust-package.Rd

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/MoE_clust.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/MoE_control.Rd

Lines changed: 7 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/MoE_gpairs.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/MoE_stepwise.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/predict.MoEClust.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/predict.MoE_expert.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/predict.MoE_gating.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)