Skip to content

Commit

Permalink
Adds more high-dim viz.
Browse files Browse the repository at this point in the history
  • Loading branch information
arokem committed May 13, 2024
1 parent 359836f commit 2caf06d
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 6 deletions.
26 changes: 25 additions & 1 deletion slides/08-viz.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,14 @@ Provides a way to explore the data or link between different attributes
:::

:::{.fragment}
<iframe src="./images/interactive.html" width="100%" height=500 frameborder="0"></iframe>
<iframe src="./images/interactive.html" width="100%" height=1000 frameborder="0"></iframe>
:::

# Using interactions

<iframe src="./images/sub-NDARAA948VFH_ses-HBNsiteRU_acq-64dir_space-T1w_desc-preproc_dwi_space-RASMM_model-CSD_desc-prob-afq_viz.html" width="100%" height=500 frameborder="0"></iframe>


# Dimensionality reduction approaches

::: {fragment}
Expand All @@ -173,5 +178,24 @@ Provides a way to explore the data or link between different attributes
- UMAP
- ...

# Demo

# Where does t-sne (and similar) shine?

![](./images/mnist.webp)

# Where does t-sne (and similar) shine?
![](./images/tsne_nist.png){height=500}

# Where does t-sne (and similar) shine?

![](./images/tsne_fashon_mnist.png){height=500}


# Combining dimensionality reduction and animation

![](./images/hypertools.gif){height=400}

[https://hypertools.readthedocs.io/en/latest/](https://hypertools.readthedocs.io/en/latest/)


33 changes: 28 additions & 5 deletions slides/code/viz_demo.r
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ library(plotly)
library(stats)
data(iris)

data <- subset(iris, select = -c(Species))
X <- subset(iris, select = -c(Species))
axis <- list(showline = FALSE,
zeroline = FALSE,
gridcolor = "#ffff",
Expand Down Expand Up @@ -122,14 +122,14 @@ fig <- fig %>%
)
fig

pca <- prcomp(data)
pca <- prcomp(X)
pca <- data.frame(PC1 = pca$x[, 1],
PC2 = pca$x[, 2],
Species = iris$Species)

fig <- plot_ly(data = pca,
x = PC1,
y = PC2,
x = ~PC1,
y = ~PC2,
type = "scatter",
mode = "markers",
split = ~iris$Species)
Expand Down Expand Up @@ -161,4 +161,27 @@ fig <- fig %>%
plot_bgcolor = "#e5ecf6"
)

fig
fig


if (!require(umap)) {
install.packages("umap")
}

library(umap)
features <- subset(iris, select = -c(Species))

set.seed(0)
umap <- umap(features, initial_dims = 2)
pdb <- data.frame(umap$layout, iris$Species)

options(warn = -1)
fig <- plot_ly(data = pdb, x = ~X1, y = ~X2,
type = "scatter", mode = "markers", split = ~iris$Species)

fig <- fig %>%
layout(
plot_bgcolor = "#e5ecf6"
)

fig
Binary file added slides/images/hypertools.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added slides/images/mnist.webp
Binary file not shown.

Large diffs are not rendered by default.

Binary file added slides/images/tsne_fashon_mnist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added slides/images/tsne_nist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added slides/images/umap_nist.webp
Binary file not shown.

0 comments on commit 2caf06d

Please sign in to comment.