Skip to content

Instantly share code, notes, and snippets.

@lars-von-buchholtz
lars-von-buchholtz / SpatialClustering.ipynb
Created February 7, 2022 18:23
Spatial Analysis of Cell Type Clustering in Microscopy Images
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lars-von-buchholtz
lars-von-buchholtz / kl_divergence.R
Last active June 25, 2021 16:17
Kullback-Leibler divergence for multivariate samples from continuous distributions
library(RANN)
kl <- function(X,Y) {
"""Estimate the Kullback-Leibler divergence between two multivariate samples.
adapted for R from python code at https://gist.github.com/atabakd/ed0f7581f8510c8587bc2f41a094b518
as described in Fernando Pérez-cruz, Kullback-Leibler Divergence Estimation of Continuous Distributions,
Proceedings of IEEE International Symposium on Information Theory, 2008, 1666--1670