Skip to content

Commit 200a98d

Browse files
authored
Merge pull request #26 from lcrawlab/new_functions
New functions
2 parents c71d87e + f14c6af commit 200a98d

File tree

10 files changed

+52
-28
lines changed

10 files changed

+52
-28
lines changed

.Rbuildignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33
^\.github$
44
^LICENSE\.md$
55
^coverage_check\.R$
6+
^cran-comments\.md$
7+
^revdep$
8+
^CRAN-SUBMISSION$

CRAN-SUBMISSION

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Version: 1.0.0
2+
Date: 2024-01-10 21:45:37 UTC
3+
SHA: 4ca8d5343e7d96380f1e1bb756d0cd12e731dfb6

DESCRIPTION

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
Package: ashapesampler
22
Title: Statistical Package for Generating Alpha Shapes
3-
Version: 0.0.0.9000
3+
Version: 1.0.0
44
Authors@R:
5-
person("Emily", "Winn-Nunez", , "emily_winn-nunez@brown.edu", role = c("aut", "cre"),
6-
comment = c(ORCID = "0000-0001-6759-5406"), person("Lorin", "Crawford",
5+
c(person("Emily", "Winn-Nunez", email="emily_winn-nunez@brown.edu", role = c("aut", "cre"),
6+
comment = c(ORCID = "0000-0001-6759-5406")), person("Lorin", "Crawford",
77
email="lorin_crawford@brown.edu", role = "aut",
88
comment = c(ORCID = "0000-0003-0178-8242")))
9-
Description: Understanding morphological variation is an important task in many applications. Recent studies in computational biology have focused on developing computational tools for the task of sub-image selection which aims at identifying structural features that best describe the variation between classes of shapes. A major part in assessing the utility of these approaches is to demonstrate their performance on both simulated and real datasets. However, when creating a model for shape statistics, real data can be difficult to access and the sample sizes for these data are often small due to them being expensive to collect. Meanwhile, the landscape of current shape simulation methods has been mostly limited to approaches that use black-box inference---making it difficult to systematically assess the power and calibration of sub-image models. In this R package, we introduce the alpha-shape sampler: a probabilistic framework for simulating realistic 2D and 3D shapes based on probability distributions which can be learned from real data or explicitly stated by the user. The ashapesampler package supports two mechanisms for sampling shapes in two and three dimensions. The first, empirically sampling based on an existing data set, was highlighted in the original main text of the paper. The second, probabalistic sampling from a known distrubtion, is the computational implementation of the theory derived in that paper.
10-
Winn-Nunez et. al. (2024)
9+
Description: Understanding morphological variation is an important task in many applications. Recent studies in computational biology have focused on developing computational tools for the task of sub-image selection which aims at identifying structural features that best describe the variation between classes of shapes. A major part in assessing the utility of these approaches is to demonstrate their performance on both simulated and real datasets. However, when creating a model for shape statistics, real data can be difficult to access and the sample sizes for these data are often small due to them being expensive to collect. Meanwhile, the landscape of current shape simulation methods has been mostly limited to approaches that use black-box inference---making it difficult to systematically assess the power and calibration of sub-image models. In this R package, we introduce the alpha-shape sampler: a probabilistic framework for simulating realistic 2D and 3D shapes based on probability distributions which can be learned from real data or explicitly stated by the user. The ashapesampler package supports two mechanisms for sampling shapes in two and three dimensions. The first, empirically sampling based on an existing data set, was highlighted in the original main text of the paper. The second, probabilistic sampling from a known distribution, is the computational implementation of the theory derived in that paper. Work based on Winn-Nunez et. al. (2024).
1110
License: GPL (>=3)
1211
Imports:
1312
pracma,

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ashapesampler 1.0.0
2+
3+
* Initial CRAN submission.

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,25 @@ Users an also use the ashapesampler package to generate shapes in two and three
3636

3737
The ashapesampler software requires the installation of the following R libraries:
3838

39-
[alphahull](https://cran.r-project.org/web/packages/alphahull/index.html)
39+
[alphahull](https://cran.r-project.org/package=alphahull)
4040

41-
[alphashape3d](https://cran.r-project.org/web/packages/alphashape3d/index.html)
41+
[alphashape3d](https://cran.r-project.org/package=alphashape3d)
4242

43-
[doParallel](https://cran.r-project.org/web/packages/doParallel/index.html)
43+
[doParallel](https://cran.r-project.org/package=doParallel)
4444

45-
[dplyr](https://cran.r-project.org/web/packages/dplyr/index.html)
45+
[dplyr](https://cran.r-project.org/package=dplyr)
4646

47-
[foreach](https://cran.r-project.org/web/packages/foreach/index.html)
47+
[foreach](https://cran.r-project.org/package=foreach)
4848

49-
[ggplot2](https://cran.r-project.org/web/packages/ggplot2/index.html)
49+
[ggplot2](https://cran.r-project.org/package=ggplot2)
5050

51-
[pracma](https://cran.r-project.org/web/packages/pracma/index.html)
51+
[pracma](https://cran.r-project.org/package=pracma)
5252

53-
[Rvcg](https://cran.r-project.org/web/packages/Rvcg/index.html)
53+
[Rvcg](https://cran.r-project.org/package=Rvcg)
5454

55-
[TDA](https://cran.r-project.org/web/packages/TDA/index.html)
55+
[TDA](https://cran.r-project.org/package=TDA)
5656

57-
[truncnorm](https://cran.r-project.org/web/packages/truncnorm/index.html)
57+
[truncnorm](https://cran.r-project.org/package=truncnorm)
5858

5959
Unless stated otherwise, the easiest way to install many of these packages is with the following example command entered in an R shell:
6060

cran-comments.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## R CMD check results
2+
3+
0 errors | 0 warnings | 1 note
4+
5+
* This is a new release.

revdep/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
checks
2+
library
3+
checks.noindex
4+
library.noindex
5+
cloud.noindex
6+
data.sqlite
7+
*.html

vignettes/probability_demo_2D.Rmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ This document illustrates how to sample $\alpha$-shapes from a true probability
2424

2525
There are several ways to adjust the hierarchical distribution of the function which will be discussed throughout the document. The function requires only parameter $N$, the number of shapes to be sampled. All other parameters are set to default, and the function samples an $\alpha$-shape from the following distribution:
2626

27-
$$\alpha \sim \mathcal{N}_T(\mu=0.25,\sigma=0.5, a=\min(0.1, \tau/4), b=\tau/2)$$
28-
$$n | \alpha = n_{c min}(\alpha, \delta=0.05)$$
29-
$$x_1, ..., x_n \sim \text{Unif}(\mathcal{M}) $$
27+
$$\alpha \sim TN(\mu=0.25,\sigma=0.5, a=\min(0.1, \tau/4), b=\tau/2)$$
28+
$$n | \alpha = n_{min}(\alpha, \delta=0.05)$$
29+
$$x_1, ..., x_n \stackrel{i.i.d.}{\sim} \text{Unif}(\mathcal{M}) $$
3030

3131
where $n$ the number of points sampled is dependent on the number of points needed to produce a connected shape for a randomly selected $\alpha$, $\delta$ is the probability that the generated shape has more than one connected component, and points are selected uniformly from some manifold $\mathcal{M}$. We could allow the lower bound of the truncated normal distribution of $\alpha$ to be as small as $a=0$, however, we set it to $a= min(0.1, tau/4)$ to prevent computational bottleneck. Bounds of the truncated normal distribution are fixed for the user. Values of $\tau$ for different underlying manifolds are as follows:
3232

vignettes/probability_demo_3D.Rmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ rglwidget()
4949

5050
To make the number of points a random variable in and of itself, we can add a discrete distribution $\pi$ to $n | \alpha$. In the code, this discrete distribution is a Poisson distribution with default $\lambda = 3$. Parameter $\lambda$ can be adjusted by the user. The distribution from which the new shape is sampled is then given by:
5151

52-
$$\alpha \sim \mathcal{N}_T(\mu=0.25,\sigma=0.5, a=\min(0.1, \tau/4), b=\tau/2)$$
53-
$$n | \alpha = n_{c min}(\alpha, \delta=0.05) + \text{Poisson}(\lambda)$$
54-
$$x_1, ..., x_n \sim \text{Unif}(\mathcal{M}) $$
52+
$$\alpha \sim NT(\mu=0.25,\sigma=0.5, a=\min(0.1, \tau/4), b=\tau/2)$$
53+
$$n | \alpha = n_{min}(\alpha, \delta=0.05) + \text{Poisson}(\lambda)$$
54+
$$x_1, ..., x_n \stackrel{i.i.d.}{\sim} \text{Unif}(\mathcal{M}) $$
5555

5656
To make the code dynamic, set `n.noise = TRUE`. This code is where $\lambda = 3$.
5757

vignettes/torus_demo.Rmd

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,21 @@ the process of learning a set of three-dimensional shapes (in this case, tori) a
3131
simulating a new shape from that. This vignette requires the packages `alphashape3d`,
3232
`alphahull`, `rgl`, `parallel`, and `doParallel` in addition to `ashapesampler`.
3333

34-
We begin by setting the parameters for our simulation. We will fix $\alpha=0.25$
35-
and $n=500$, and draw 20 shapes for our data set. Our true underlying manifold
36-
will be the torus with major radius 0.75 and minor radius 0.25.
34+
Within vignettes, we are unable to set the number of cores above 2L. However, we highly
35+
recommend using as many cores on the machine as possible to parallelize the code and
36+
expedite computation, especially with 3D calculations.
37+
38+
We begin by setting the parameters for our simulation. We will fix $\alpha=0.15$
39+
and $n=1000$, and draw 20 shapes for our data set. Our true underlying manifold
40+
will be the torus with major radius 0.5 and minor radius 0.15.
3741

3842
```{r}
3943
N=10
4044
tau_vec <- vector("numeric", N)
41-
my_alpha <- 0.25
42-
n <- 5000
43-
r_maj <- 0.75
44-
r_min <- 0.25
45+
my_alpha <- 0.15
46+
n <- 1000
47+
r_maj <- 0.5
48+
r_min <- 0.15
4549
```
4650

4751
Next we will draw the shapes themselves.

0 commit comments

Comments
 (0)