You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(If you are reading this on GitHub, see the full [documentation](https://oneilsh.github.io/tidytensor/) on GitHub pages.)
10
+
*If you are reading this on [GitHub](https://github.com/oneilsh/tidytensor) be sure to check out the full [documentation](https://oneilsh.github.io/tidytensor/) on GitHub pages.*
11
11
12
-
TidyTensor is an R package for inspecting and manipulating tensors (multidimensional arrays). It provides an improved `print()`function for summarizing structure, named tensors, conversion to data frames, and high-level manipulation functions. Designed to complement the excellent`keras` package, functionality is layered on top of base R types.
12
+
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.
13
13
14
14
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.
15
15
16
16
17
17
<br />
18
18
<br />
19
19
20
-
## Installation and Usage
20
+
## Installation
21
21
22
22
A simple `devtools::install_github("oneilsh/tidytensor")` will do it. If you don't have `devtools`, first grab it with `install.packages("devtools")`.
23
23
24
-
See the [Getting Started](https://oneilsh.github.io/tidytensor/articles/tidytensor.html) vignette for a summary of features and usage.
25
-
26
24
If you use TidyTensor, let us know in an [issue](https://github.com/oneilsh/tidytensor/issues/new)!
27
25
28
26
<br />
29
27
<br />
30
28
29
+
## Examples and Usage
30
+
31
+
Here we provide just two basic examples of how TidyTensor can help illuminate data used for deep learning. See the [Getting Started](https://oneilsh.github.io/tidytensor/articles/tidytensor.html) vignette for more examples of visualizing tensor structure, filtering and data augmentation, producing train/test splits, and other handy features.
32
+
33
+
34
+
Consider the `CIFAR10` dataset distributed with the `keras` library:
35
+
36
+
```
37
+
## library(keras)
38
+
cifar10_raw <- dataset_cifar10()$train$x
39
+
```
40
+
41
+
TidyTensor can be used to plot the contained image data with the help of other `tidyverse` packages:
42
+
43
+
```
44
+
## library(tidytensor)
45
+
## library(ggplot2)
46
+
## library(tidyr)
47
+
48
+
cifar10_raw %>%
49
+
as.tidytensor() %>%
50
+
set_ranknames(image, row, col, channel) %>%
51
+
set_dimnames_for_rank(channel, R, G, B) %>%
52
+
subset(image = 1:4) %>%
53
+
as.data.frame() %>%
54
+
spread(channel, value) %>%
55
+
ggplot() +
56
+
geom_tile(aes(x = col, y = row, fill = rgb(R, G, B, maxColorValue = 255))) +
0 commit comments