Skip to content

Commit

Permalink
version 0.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dbdahl authored and cran-robot committed Oct 2, 2017
1 parent 690f850 commit 006303f
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 44 deletions.
12 changes: 6 additions & 6 deletions DESCRIPTION
@@ -1,17 +1,17 @@
Package: shallot
Type: Package
Title: Random Partition Distribution Indexed by Pairwise Information
Version: 0.4.1
Date: 2017-08-24
Description: Implementations are provided for the models described in the paper D. B. Dahl, R. Day, J. Tsai (2017) <DOI:10.1080/01621459.2016.1165103>. The Ewens, Ewens-Pitman, Ewens attraction, Ewens-Pitman attraction, and ddCRP distributions are available for prior and posterior simulation. Posterior simulation is based on a user-supplied likelihood. Supporting functions for partition estimation and plotting are also provided.
Version: 0.4.3
Date: 2017-10-02
Description: Implementations are provided for the models described in the paper D. B. Dahl, R. Day, J. Tsai (2017) <DOI:10.1080/01621459.2016.1165103>. The Ewens, Ewens-Pitman, Ewens attraction, Ewens-Pitman attraction, and ddCRP distributions are available for prior and posterior simulation. Posterior simulation is based on a user-supplied likelihood. Supporting functions for partition estimation and plotting are also provided.
Authors@R: c(person(given="David B.",family="Dahl",role=c("aut","cre"),email="dahl@stat.byu.edu"))
URL: https://github.com/dbdahl/shallot
BugReports: https://github.com/dbdahl/shallot/issues
Imports: rscala (>= 2.3.1), commonsMath, stats
Imports: rscala (>= 2.4.0), commonsMath, stats
License: Apache License 2.0 | file LICENSE
NeedsCompilation: no
Packaged: 2017-08-25 05:26:42 UTC; dahl
Packaged: 2017-10-02 16:37:22 UTC; dahl
Author: David B. Dahl [aut, cre]
Maintainer: David B. Dahl <dahl@stat.byu.edu>
Repository: CRAN
Date/Publication: 2017-08-25 08:48:04 UTC
Date/Publication: 2017-10-02 18:47:08 UTC
20 changes: 10 additions & 10 deletions MD5
@@ -1,15 +1,15 @@
f902e0a5c8d9dd3d548c7aecb147bdb1 *DESCRIPTION
fc85dbd14fd0f181c258cd6987fff4d4 *DESCRIPTION
e3fc50a88d0a364313df4b21ef20c29e *LICENSE
aa235aee9ccccc7978c0912e8f1bafb9 *NAMESPACE
c07e871db0c4572d75470c24029d875a *NEWS
81f2cae88c3a8ed78993622c96991c39 *R/onLoad.R
3191282b142755af312c39c5203dbd13 *R/shallot.R
5cd8ea7706c9464c3cb3e0099a1cbe17 *NAMESPACE
1121f229f76f082ea8a55b873321b7f0 *NEWS
3098ab5ccd8f5199b08aba79590ae72d *R/onLoad.R
ac0e874ce3d8e57fec09a41a09b4ed4e *R/shallot.R
38140116b27868c5032c0114cc3653ad *inst/COPYRIGHT
5c90faa407afb1d63f9759139892b8d3 *inst/java/scala-2.10/shallot.jar
63e40a002f83d2f7d3f57069358d8aa6 *inst/java/scala-2.11/shallot.jar
84d048c46bb1dcc2ae850431c79bc589 *inst/java/scala-2.12/shallot.jar
ef827de73b64c06aedc2354e78c924b5 *inst/java/scala-2.10/shallot.jar
3b87660f8778a8983e7702f4c004d763 *inst/java/scala-2.11/shallot.jar
b91c8b1089ca0c0af06ca104257d5bc6 *inst/java/scala-2.12/shallot.jar
66b9460eed24d88d574c07df559258d4 *java/README
72697dc2c5ff991b6f3859457fc555a0 *java/shallot-sources.jar
170262b2ab9e2d056d71a1e5e35d9686 *java/shallot-sources.jar
0a2ad439329604c69d00af63f2ae61ee *man/adj.rand.index.Rd
d518233e57718129f68d04d096bd0a07 *man/attraction.Rd
85fe9baf2eb72800f335d799f90b5664 *man/decay.Rd
Expand All @@ -24,6 +24,6 @@ d518233e57718129f68d04d096bd0a07 *man/attraction.Rd
1c13268561458790bddb05c5ca42cdf5 *man/plot.partition.Rd
394a7bc57963a3c0194b0ca7eaa7d780 *man/process.samples.Rd
9b5a5c836165e07d36b8603bd4268771 *man/sample.partitions.Rd
26333e8926e8b141dc96b91ed7aaf81d *man/sample.partitions.posterior.Rd
368cc952cae4a72edf0416796343f340 *man/sample.partitions.posterior.Rd
5953f84a6596f44e953b5770015a9edf *man/sampling.model.Rd
ce0f4c50110c4e5e2d6312847792fd4b *man/shallot-package.Rd
2 changes: 1 addition & 1 deletion NAMESPACE
Expand Up @@ -4,7 +4,7 @@ import(stats)

importFrom("grDevices", "heat.colors", "rainbow", "topo.colors")
importFrom("graphics", "abline", "axis", "box", "image", "pairs", "par", "points", "polygon", "segments", "text")
importFrom("utils", "capture.output", "txtProgressBar", "setTxtProgressBar")
importFrom("utils", "capture.output", "txtProgressBar", "setTxtProgressBar", "install.packages")

export(adj.rand.index)
export(mass)
Expand Down
6 changes: 6 additions & 0 deletions NEWS
@@ -1,3 +1,9 @@
0.4.3 (2017-10-02)
* Circumvent a problem with 'R CMD check' not finishing on Windows.

0.4.2 (2017-09-27)
* Updated to latest rscala.

0.4.1 (2017-08-24)
* Minor update to correctly describe the package functionality.

Expand Down
10 changes: 5 additions & 5 deletions R/onLoad.R
Expand Up @@ -15,14 +15,14 @@
r.reSeed(seed)
r
}
// This circumvents a bug in the class loader on some versions of Scala/JVM.
scala.util.Try {
new org.apache.commons.math3.random.EmpiricalDistribution()
}
'
## Users may want to use 'options(rscala.heap.maximum="2G")'.
.rscalaPackage(pkgname,classpath.packages="commonsMath",snippet=snippet)
## This circumvents a bug in the class loader of Scala 2.11.x.
sInfo <- scalaInfo()
if ( ( ! is.null(sInfo) ) && ( sInfo$major.release == "2.11" ) ) {
s$.org.apache.commons.math3.random.EmpiricalDistribution$new()
}
}

.onUnload <- function(libpath) {
Expand Down
52 changes: 31 additions & 21 deletions R/shallot.R
Expand Up @@ -54,11 +54,11 @@ mass <- function(...,fixed=TRUE) {
}

# Not exported: Mass wrapper
.mass <- function(mass=NULL) s %.!% '
.mass <- function(mass) s %.!% '
Mass(R.evalD0(mass+"$value"))
'

.massFactory <- function(mass=NULL) s %.!% '
.massFactory <- function(mass) s %.!% '
if ( R.evalL0(mass+"$fixed") ) {
Mass.factory(R.evalD0(mass+"$value"))
} else {
Expand Down Expand Up @@ -103,11 +103,11 @@ discount <- function(...,fixed=TRUE) {
}

# Not exported: Discount wrapper
.discount <- function(discount=NULL) s %.!% '
.discount <- function(discount) s %.!% '
Discount(R.evalD0(discount+"$value"))
'

.discountFactory <- function(discount=NULL) s %.!% '
.discountFactory <- function(discount) s %.!% '
if ( R.evalL0(discount+"$fixed") ) {
Discount.factory(R.evalD0(discount+"$value"))
} else {
Expand Down Expand Up @@ -647,16 +647,19 @@ nsubsets.variance <- function(x) {
(labels, parameters)
'

.sampleForward <- function(nSamples=0L, rdg=scalaNull('RDG'), sampler=scalaNull('Function2[Int, RDG, List[Partition[Null]]]'), parallel=TRUE) s %.!% '
if (!parallel) sampler(nSamples, rdg)
else {
val nCores = Runtime.getRuntime.availableProcessors
val nSamplesPerCore = (nSamples / nCores) + 1
val randomGenerator = rdg.getRandomGenerator
val rdgList = List.fill(nCores) { new RDG(randomGenerator) }
rdgList.par.map(r => sampler(nSamplesPerCore, r)).toList.flatten
}
'
.sampleForward <- function(nSamples, rdg=scalaNull('RDG'), sampler=scalaNull('Function2[Int, RDG, List[Partition[Null]]]'), parallel=TRUE) {
nSamples <- as.integer(nSamples)
s %.!% '
if (!parallel) sampler(nSamples, rdg)
else {
val nCores = Runtime.getRuntime.availableProcessors
val nSamplesPerCore = (nSamples / nCores) + 1
val randomGenerator = rdg.getRandomGenerator
val rdgList = List.fill(nCores) { new RDG(randomGenerator) }
rdgList.par.map(r => sampler(nSamplesPerCore, r)).toList.flatten
}
'
}

# Sample partitions.
sample.partitions <- function(x, n.draws, parallel=TRUE) {
Expand All @@ -674,11 +677,11 @@ sample.partitions <- function(x, n.draws, parallel=TRUE) {
}

print.shallot.samples.raw <- function(x, ...) {
cat("raw partition samples --- use the 'process.partition' function to extract information\n")
cat("raw partition samples --- use the 'process.samples' function to extract information\n")
}

print.shallot.samples.full <- function(x, ...) {
cat("raw partition samples with hyperparameter values --- use the 'process.partition' function to extract information\n")
cat("raw partition samples with hyperparameter values --- use the 'process.samples' function to extract information\n")
}


Expand All @@ -691,7 +694,7 @@ sample.partitions.posterior <- function(partition, sampling.model, partition.mod
pmR=NULL,
pmType="",
rdg=scalaNull("RDG"),
progressBar=NULL, showProgressBar=TRUE) s %.!% '
progressBar, showProgressBar=TRUE) s %.!% '
val nDraws = R.getI0("n.draws")
val k = R.evalI0("k")
val massRWSD = R.evalD0("massRWSD")
Expand Down Expand Up @@ -910,7 +913,7 @@ sampling.model <- function(sample.parameter, log.density) {
structure(r, class="shallot.distribution.data")
}

.samplingModel <- function(samplingModel=NULL) {
.samplingModel <- function(samplingModel) {
s %.!% '
val sp = R.evalReference(samplingModel+"$sample.parameter")
val ld = R.evalReference(samplingModel+"$log.density")
Expand Down Expand Up @@ -1006,9 +1009,12 @@ estimate.partition <- function(x, pairwise.probabilities=NULL, max.subsets=0, ma


# Confidence
.labels2partition <- function(partition=integer(), samplingModel=scalaNull("SamplingModel[PersistentReference]")) s %.!% '
Partition(samplingModel,partition)
'
.labels2partition <- function(partition, samplingModel=scalaNull("SamplingModel[PersistentReference]")) {
partition <- as.integer(partition)
s %.!% '
Partition(samplingModel,partition)
'
}

.partition2partition <- function(partition) {
stop("Not yet implemented.")
Expand Down Expand Up @@ -1109,3 +1115,7 @@ plot.shallot.confidence <- function(x, partition=NULL, data=NULL, show.labels=le
invisible()
}

latest <- function() {
install.packages('https://dahl.byu.edu/public/shallot_LATEST.tar.gz',repos=NULL,type='source')
}

Binary file modified inst/java/scala-2.10/shallot.jar
Binary file not shown.
Binary file modified inst/java/scala-2.11/shallot.jar
Binary file not shown.
Binary file modified inst/java/scala-2.12/shallot.jar
Binary file not shown.
Binary file modified java/shallot-sources.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion man/sample.partitions.posterior.Rd
Expand Up @@ -36,7 +36,7 @@ If this function is interrupted by the user, the computation engine will be brok
\code{\link{sample.partitions}}
}
\examples{
\dontrun{
\donttest{
mass <- mass(1.0, fixed=TRUE)
discount <- discount(0.05, fixed=TRUE)
distance <- dist(scale(USArrests[1:9,]))
Expand Down

0 comments on commit 006303f

Please sign in to comment.