Questions tagged [kernel-density]

kernel density estimation is a non-parametric way to estimate the probability density function of a random variable.

Kernel density estimation is a fundamental data smoothing problem where inferences about the population are made, based on a finite data sample. Kernel density estimates are closely related to histograms, but can be endowed with properties such as smoothness or continuity by using a suitable kernel

http://en.wikipedia.org/wiki/Kernel_density_estimation

656 questions
0
votes
1 answer

Kernel density estimation of the histogram of an image

I'm trying to perform a Kernel Density Estimation on my histogram which has been computed over an image: I use scikit learn to compute the kernel density estimation using a gaussian kernel: histogram = np.histogram(img, bins=256, range=(0,255),…
neon29
  • 179
  • 1
  • 3
  • 13
0
votes
1 answer

Coordinates of greatest kernel density for trivariate KDE

I have calculated the kernel density of a 3-column matrix in R using the following code: ss<-read.table("data.csv",header=TRUE,sep=",") x<-ss[,1] y<-ss[,2] z<-ss[,3] ssdata<-c(x,y,z) ssmat<-matrix(ssdata,,3) rp<-kde(ssmat) plot(rp) What I need now…
0
votes
1 answer

Kernel Density estimation - absolute numbers

I have been using kernel density estimation for a while, but so far I always escaped the easy way by just analysing and normalised distributions where intercomparisons between different sets were not necessary. In my current project I want to…
HansSnah
  • 2,160
  • 4
  • 18
  • 31
0
votes
1 answer

How to show the Bandwidth Matrix in Kernel Density Estimation?

I am using the scipy implementation of KDE to find the density estimation for 3-Dimensional data kde source. I was wondering how to get the bandwidth matrix for kde in scipy.kde . For 1D its just a scaler but for 3d it suppose to be a 3X3 matrix.…
jquery404
  • 653
  • 1
  • 12
  • 26
0
votes
0 answers

Why does R density function return nonzero values outside the interval [from, to]?

I have entered into the R code of the density function, and I have noticed the following strange lines: lo <- from - 4 * bw up <- to + 4 * bw To my understanding, they mean that the density is estimated on the interval [from - 4*bw, to + 4*bw]…
polmath
  • 335
  • 2
  • 13
0
votes
1 answer

Inconsistency between gaussian_kde and density integral sum

Can one explain why after estimation of kernel density d = gaussian_kde(g[:,1]) And calculation of integral sum of it: x = np.linspace(0, g[:,1].max(), 1500) integral = np.trapz(d(x), x) I got resulting integral sum completely different to…
Ivan Sudos
  • 1,423
  • 2
  • 13
  • 25
0
votes
1 answer

Efficiently find empirical density() for many arbitrary sample values (like dnorm(), but for empirical distribution)

Say you've defined an empirical density (sample.density) for a sample of x.sample as in the following: set.seed(1) x.sample <- rnorm(100) sample.density <- density(x.sample) Now say that we have a gradient, G, for which we would like to know the…
rbatt
  • 4,677
  • 4
  • 23
  • 41
0
votes
1 answer

Why does KernelDensity.score_samples compute the distance on each node?

I'm using a KD-estimation with a custom metric. The metric is obviously slower than the builtin euclidean distance, but works fine. When doing kde=KernelDensity(...) kde.fit(X) I get results in a reasonable amount of time. When I then…
user4720834
0
votes
0 answers

How to calculate the integral of product of three kernel density functions in R?

I want to calculate the integral of product of three kernel density functions. In order to do that, after finding the kernel densities, I should find an approximate function for the product of them and then calculate the integral (with parametric…
Ferra
  • 9
  • 4
0
votes
0 answers

Mean Square Error (MSE) function argument "poly"

I'm trying to estimate an initial bandwidth value for kernel smoothing my data, calculating the Mean Square Errors (function "mse2d"), but got stuck with an error in a polygon implementation code in function's argument. I'm following an example in…
Leila
  • 1
0
votes
1 answer

GridSearchCV with KernelDensity and custom scorer yields same result as without scorer

I'm using scikit-slearn 0.14 and trying to implement a user defined scoring function for GridSearchCV to evaluate. def someScore(gtruth, pred): pred = np.clip(pred, 0, np.inf) logdif = np.log(1 + gtruth) - np.log(1 + pred) return…
user4720834
0
votes
0 answers

For a given location, identify minimum kernel density isopleth

I am undertaking research looking at the interactions of individual rats with a grid of traps distributed across the landscape (I have x, y coordinates for all trap locations). For each rat, I have generated a kernel utilisation density "home range"…
NZHelen
  • 43
  • 1
  • 1
  • 5
0
votes
1 answer

Seaborn distplot: y axis problems with multiple kdeplots

I am currently plotting 3 kernel density estimations together on the same graph. I assume that kdeplots use relative frequency as the y value, however for some of my data the kdeplot has frequencies way above 1. code I'm using: sns.distplot(data1,…
Charlietrypsin
  • 107
  • 1
  • 15
0
votes
1 answer

Optimize computation time for PDF approximation based on Kernel Density Estimation

I have a code to find the pdf's approximation of a vector based on the formula for kernel estimation: I implemented this formula in the code below (see previous question). However, that code takes long time to run (two loops are used). Could you…
0
votes
1 answer

adehabitatHR KD ID and XY assignement

I am fairly new to R. I would like to use the adehabitatHR package to create kernel density and isopleths from my sea turtle GPS data. I’m running into some issues… Basically I am having trouble assigning IDs and XY fields within R to create KDs…
gemme001
  • 1
  • 2