TidyTensor
TidyTensor: Utilities for multidimensional arrays as named hierarchical structures - Published in JOSS (2021)
Science Score: 93.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
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org, zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Scientific Fields
Repository
Utilities for multidimensional arrays as named hierarchical structures
Basic Info
Statistics
- Stars: 4
- Watchers: 0
- Forks: 1
- Open Issues: 0
- Releases: 4
Metadata Files
README.md
If you are reading this on GitHub be sure to check out the full documentation on GitHub pages.
TidyTensor is an R package for inspecting and manipulating tensors (multidimensional arrays). It provides an improved print() for summarizing structure, named tensors, conversion to data frames, and high-level manipulation functions. Designed to complement the keras package for deep learning in R, functionality is layered on top of base R types.
TidyTensor was inspired by a workshop I taught in deep learning with R, and a desire to explain and explore tensors in a more intuitive way.
Installation
A simple devtools::install_github("oneilsh/tidytensor") will do it. If you don't have devtools, first grab it with install.packages("devtools").
If you use TidyTensor, let us know in an issue!
Examples and Usage
Here we provide just two basic examples of how TidyTensor can help illuminate data used for deep learning. See the Getting Started vignette for more examples of visualizing tensor structure, filtering and data augmentation, producing train/test splits, and other handy features.
Consider the CIFAR10 dataset distributed with the keras library:
```
library(keras)
cifar10raw <- datasetcifar10()$train$x ```
TidyTensor can be used to plot the contained image data with the help of other tidyverse packages:
```
library(tidytensor)
library(ggplot2)
library(tidyr)
cifar10raw %>% as.tidytensor() %>% setranknames(image, row, col, channel) %>% setdimnamesforrank(channel, R, G, B) %>% subset(image = 1:4) %>% as.data.frame() %>% spread(channel, value) %>% ggplot() + geomtile(aes(x = col, y = row, fill = rgb(R, G, B, maxColorValue = 255))) + facetwrap( ~ image) + coordequal() + scaleyreverse() + scalefillidentity() ```

For a second example, we can start with a keras model and generate a function mapping inputs to internal feature map representations:
``` vggmodel <- applicationvgg16(includetop = FALSE, inputshape = c(32, 32, 3))
input <- vggmodel$input output <- getlayer(vggmodel, name = "block1conv2")$output
input shape (N, 32, 32, 3)
output shape (N, 32, 32, 64) tensor, where last rank are feature maps
computefeaturemaps <- kfunction(input, output) ```
TidyTensor can then be used to feed a given set of input tensors through the function and visualize the resulting convolutional feature maps:
(cifar10_raw / 255) %>%
as.tidytensor() %>%
set_ranknames(image, row, col, channel) %>%
set_dimnames_for_rank(channel, R, G, B) %>%
subset(image = 1:4) %>%
compute_featuremaps() %>%
as.tidytensor() %>%
set_ranknames(image, row, col, featuremap) %>%
subset(featuremap = 1:6) %>%
as.data.frame() %>%
ggplot() +
geom_tile(aes(x = col, y = row, fill = value)) +
facet_grid(image ~ featuremap) +
coord_equal() +
scale_y_reverse()

Contributing
Pull requests welcome! Please see the CONTRIBUTING.md file for details.
We are especially interested in additional methods for visualizing or summarizing the structure and content of TidyTensors.
Changelog
- v1.0.0: Minor documentation improvements, version 1.0 minted for JOSS publication
- v0.9.1: preparation for JOSS submission, many documentation improvements, removing
allow_hugeoption fromas.data.frame.tidytensor() - v0.9.0: refactor
bottomparamter ofprint()tobase_rank - v0.8.2: minor bugfixes, new combine_ranks() function
- v0.8.1: add [] and [] <- functionality
- v0.8: first version on github
Owner
- Name: Shawn T O'Neil
- Login: oneilsh
- Kind: user
- Location: Corvallis, OR
- Company: Department of Biomedical Informatics, CU Anschutz
- Website: http://shawntoneil.com
- Repositories: 59
- Profile: https://github.com/oneilsh
Assistant Prof @ CU Anschutz Med School | TISLab | Biomedical Informatics | Data Engineering | ML | Bioinformatics | Curious Learner & Passionate Educator
JOSS Publication
TidyTensor: Utilities for multidimensional arrays as named hierarchical structures
Authors
Tags
deep learning array tensor tidyGitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Shawn O'Neil | o****h@g****m | 145 |
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 4
- Total pull requests: 4
- Average time to close issues: 2 days
- Average time to close pull requests: about 22 hours
- Total issue authors: 3
- Total pull request authors: 1
- Average comments per issue: 1.25
- Average comments per pull request: 0.0
- Merged pull requests: 4
- 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
- nhejazi (2)
- danagibbon (1)
- omid-s (1)
Pull Request Authors
- oneilsh (4)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- abind * imports
- magrittr * imports
- purrr * imports
- rlang * imports
- rstackdeque * imports
- tidyselect * imports
- covr * suggests
- dplyr * suggests
- ggplot2 * suggests
- keras * suggests
- knitr * suggests
- markdown * suggests
- reticulate * suggests
- stringr * suggests
- testthat * suggests
- tidyr * suggests
