ferrn

Facilitate Exploration of touRR optimisatioN (ferrn)

https://github.com/huizezhang-sherry/ferrn

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 5 committers (20.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.6%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

Facilitate Exploration of touRR optimisatioN (ferrn)

Basic Info
Statistics
  • Stars: 6
  • Watchers: 4
  • Forks: 2
  • Open Issues: 0
  • Releases: 1
Created about 6 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
bibliography: '`r system.file("reference.bib", package = "ferrn")`'
editor_options: 
  chunk_output_type: console
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%", 
  message = FALSE
)
```

# ferrn 

[![R build status](https://github.com/huizezhang-sherry/ferrn/workflows/R-CMD-check/badge.svg)](https://github.com/huizezhang-sherry/ferrn/actions)


The **ferrn** package extracts key components from the data object collected during projection pursuit (PP) guided tour optimisation, produces diagnostic plots, and calculates PP index scores.

## Installation

You can install the development version of ferrn from [GitHub](https://github.com/) with:

```{r eval = FALSE}
# install.packages("remotes")
remotes::install_github("huizezhang-sherry/ferrn")
```


## Visualise PP optimisation

The data object collected during a PP optimisation can be obtained by assigning the `tourr::annimate_xx()` function a name. In the following example, the projection pursuit is finding the best projection basis that can detect multi-modality for the `boa5` dataset using the `holes()` index function and the optimiser `search_better`:

```{r eval = FALSE}
set.seed(123456)
holes_1d_better <- animate_dist(
  ferrn::boa5,
  tour_path = guided_tour(holes(), d = 1, search_f =  search_better), 
  rescale = FALSE)
holes_1d_better
```

The data structure includes the `basis` sampled by the optimiser, their corresponding index values (`index_val`), an `information` tag explaining the optimisation states, and the optimisation `method` used (`search_better`). The variables `tries` and `loop` describe the number of iterations and samples in the optimisation process, respectively. The variable `id` serves as the global identifier.

The best projection basis can be extracted via 

```{r get-best}
library(ferrn)
library(dplyr)
holes_1d_better %>% get_best()
holes_1d_better %>% get_best() %>% pull(basis) %>% .[[1]]
holes_1d_better %>% get_best() %>% pull(index_val)
```

The trace plot can be used to view the optimisation progression:

```{r trace-plot}
holes_1d_better %>% 
  explore_trace_interp() + 
  scale_color_continuous_botanical()
```

Different optimisers can be compared by plotting their projection bases on the reduced PCA space. Here `holes_1d_geo` is the data obtained from the same PP problem as `holes_1d_better` introduced above, but with a `search_geodesic` optimiser. The 5 $\times$ 1 bases from the two datasets are first reduced to 2D via PCA, and then plotted to the PCA space. (PP bases are ortho-normal and the space for $n \times 1$ bases is an $n$-d sphere, hence a circle when projected into 2D.)

```{r pca-plot}
bind_rows(holes_1d_geo, holes_1d_better) %>%
  bind_theoretical(matrix(c(0, 1, 0, 0, 0), nrow = 5),
                   index = tourr::holes(), raw_data = boa5) %>% 
  explore_space_pca(group = method, details = TRUE)  +
  scale_color_discrete_botanical()
```

The same set of bases can be visualised in the original 5-D space via tour animation:

```{r tour-anim, eval = FALSE}
bind_rows(holes_1d_geo, holes_1d_better) %>%
  explore_space_tour(flip = TRUE, group = method,
                     palette = botanical_palettes$fern[c(1, 6)],
                     max_frames = 20, 
                     point_size = 2, end_size = 5)
```

```{r eval = FALSE, echo = FALSE}
prep <- prep_space_tour(dplyr::bind_rows(holes_1d_better, holes_1d_geo), 
                        flip = TRUE, group = method, 
                        palette = botanical_palettes$fern[c(1,6)], 
                        axes = "bottomleft",
                        point_size = 2, end_size = 5)

# render gif
set.seed(123456)
render_gif(
  prep$basis,
  tour_path = grand_tour(),
  display = display_xy(col = prep$col, cex = prep$cex, pch = prep$pch,
                       edges = prep$edges, edges.col = prep$edges_col,
                       axes = "bottomleft"),
  rescale = FALSE,
  frames = 20,
  gif_file = here::here("man", "figures","tour.gif")
)
```


# Reference

Owner

  • Name: Sherry Zhang
  • Login: huizezhang-sherry
  • Kind: user
  • Location: Austin, Texas, USA
  • Company: University of Texas at Austin

GitHub Events

Total
  • Push event: 16
  • Fork event: 1
Last Year
  • Push event: 16
  • Fork event: 1

Committers

Last synced: over 3 years ago

All Time
  • Total Commits: 204
  • Total Committers: 5
  • Avg Commits per committer: 40.8
  • Development Distribution Score (DDS): 0.064
Top Committers
Name Email Commits
Sherry h****h@g****m 191
GitHub Actions a****s@g****m 5
dicook v****t@g****m 4
Sherry Zhang 3****y@u****m 3
huizezhang-sherry h****g@m****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 8
  • Total pull requests: 1
  • Average time to close issues: about 1 month
  • Average time to close pull requests: almost 3 years
  • Total issue authors: 3
  • Total pull request authors: 1
  • Average comments per issue: 2.63
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • dicook (6)
  • huizezhang-sherry (2)
  • DavisVaughan (1)
Pull Request Authors
  • emitanaka (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 247 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 3
  • Total maintainers: 1
cran.r-project.org: ferrn

Facilitate Exploration of touRR optimisatioN

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 247 Last month
Rankings
Forks count: 17.8%
Stargazers count: 22.5%
Dependent packages count: 29.8%
Average: 32.5%
Dependent repos count: 35.5%
Downloads: 57.0%
Maintainers (1)
Last synced: 11 months ago

Dependencies

DESCRIPTION cran
  • R >= 2.10 depends
  • dplyr * imports
  • geozoo * imports
  • gganimate * imports
  • ggforce * imports
  • ggplot2 * imports
  • ggrepel * imports
  • magrittr * imports
  • purrr * imports
  • rlang >= 0.1.2 imports
  • scales * imports
  • stringr * imports
  • tibble * imports
  • tidyr * imports
  • tourr * imports
  • covr * suggests
  • forcats * suggests
  • patchwork * suggests
  • pkgdown * suggests
  • roxygen2 * suggests
  • testthat * suggests
.github/workflows/check-standard.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite