Nothing
## ---- echo=FALSE, results="hide", message=FALSE----------------------------
require(knitr)
opts_chunk$set(error=FALSE, message=FALSE, warning=FALSE)
library(kmknn)
## --------------------------------------------------------------------------
nobs <- 10000
ndim <- 20
data <- matrix(runif(nobs*ndim), ncol=ndim)
fout <- findKNN(data, k=10)
head(fout$index)
head(fout$distance)
## --------------------------------------------------------------------------
fout$index[3,]
## --------------------------------------------------------------------------
fout$distance[3,]
## --------------------------------------------------------------------------
nquery <- 1000
ndim <- 20
query <- matrix(runif(nquery*ndim), ncol=ndim)
qout <- queryKNN(data, query, k=5)
head(qout$index)
head(qout$distance)
## --------------------------------------------------------------------------
qout$index[3,]
## --------------------------------------------------------------------------
qout$distance[3,]
## --------------------------------------------------------------------------
fout <- findNeighbors(data, threshold=1)
head(fout$index)
head(fout$distance)
## --------------------------------------------------------------------------
fout$index[[3]]
## --------------------------------------------------------------------------
fout$distance[[3]]
## --------------------------------------------------------------------------
findKNN(data, k=5, subset=3:5)
## --------------------------------------------------------------------------
names(findKNN(data, k=2, get.distance=FALSE))
## --------------------------------------------------------------------------
pre <- precluster(data)
out1 <- findKNN(precomputed=pre, k=5)
out2 <- queryKNN(precomputed=pre, query=query, k=2)
out3 <- findNeighbors(precomputed=pre, threshold=2)
## --------------------------------------------------------------------------
library(scRNAseq)
data(allen)
## --------------------------------------------------------------------------
library(scater)
sce <- as(allen, "SingleCellExperiment")
sce <- normalize(sce, exprs_values="tophat_counts")
sce <- runPCA(sce, ncomponents=50)
dim(reducedDim(sce, "PCA"))
## --------------------------------------------------------------------------
nns <- findKNN(reducedDim(sce, "PCA"), k=10)
head(nns$index)
head(nns$distance)
## --------------------------------------------------------------------------
sessionInfo()
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.