Skip to content

Commit

Permalink
fixed link
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-anders committed Jun 18, 2024
1 parent 8c7ea18 commit 5f6576f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 30 deletions.
2 changes: 1 addition & 1 deletion _site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ <h2 class="anchored" data-anchor-id="material-and-video-recodings">Material and
<li>Lecture of 2024-06-17
<ul>
<li>Video (not yet uploaded)</li>
<li><a href="missing.html">Comparison of t-SNE and UMAP for our example data</a></li>
<li><a href="umap_vs_tsne.html">Comparison of t-SNE and UMAP for our example data</a></li>
<li><a href="tsne_umap_math.html">Mathematics of t-SNE and UMAP</a></li>
<li><a href="UMAP_pedestrian.html">Reimplementing UMAP in Python</a></li>
</ul></li>
Expand Down
2 changes: 1 addition & 1 deletion index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Place:
- [Laplacian eigenmaps](laplacian_eigenmap.html)
- Lecture of 2024-06-17
- Video (not yet uploaded)
- [Comparison of t-SNE and UMAP for our example data](missing.html)
- [Comparison of t-SNE and UMAP for our example data](umap_vs_tsne.html)
- [Mathematics of t-SNE and UMAP](tsne_umap_math.html)
- [Reimplementing UMAP in Python](UMAP_pedestrian.html)
- prepared for following lectures
Expand Down
29 changes: 1 addition & 28 deletions umap_vs_tsne.qmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
Comparing UMAP and t-SNE
title: Comparing UMAP and t-SNE
---

Here, we compare the two dimension reduction methods, t-SNE and UMAP, applied
Expand Down Expand Up @@ -59,30 +59,3 @@ sleepwalk::sleepwalk(
list( Embeddings(seu,"pca"), Embeddings(seu,"pca") ),
maxdists = c( 30, 30 ) )
```

plot( NULL, xlim=c(1,1000), ylim=c(1,30000), log="xy", xlab="distance", ylab="#")
for(j in 1:100 ) {
i <- sample.int(nrow(x),1)
lines( sort( sqrt(colSums( ( t(x) - x[i,] )^2 )) ), 1:nrow(x), col="#00000030" ) }

plot( NULL, xlim=c(1,100), ylim=c(1,300), log="xy", xlab="distance", ylab="#")
for(j in 1:100 ) {
i <- sample.int(nrow(x),1)
js <- sample.int(nrow(x), 300, replace=TRUE)
d <- sqrt(colSums( ( t(x[js,]) - x[i,] )^2 ))
lines( sort(d), 1:length(js), col="#00000030" ) }

segments(20,1,200,1*10^c(1,2,3,5,10))


nn <- FNN::get.knn(x,300)

Embeddings(seu,"umap") %>%
as_tibble() %>%
add_column( dim = log(30)/log(nn$nn.dist[,300]/nn$nn.dist[,10]) ) %>%
add_column( dens = log(1/nn$nn.dist[,300]) ) %>%
ggplot() +
geom_point( aes( x=dens, y=dim ), size=.1 )
geom_point( aes( x=umap_1, y=umap_2, col=dens ), size=.1 ) +
scale_color_viridis_c() #limits=c(1,10), oob=scales::oob_squish)

0 comments on commit 5f6576f

Please sign in to comment.