# Density Calculations

Well, I consider it one gun. :-) But instead of a single KNN search, it does 4 of them and combines the results.

You should be able to hazard a guess at the margin of error by looking at the distribution of those 15 values. Isn't it 1.96 * standard deviation = 95% confidence interval? Edit: Er, then divided by sqrt(num battles)? I don't know, but it's not hard to find. :-)

Does it use different trees for the different searches? Isn't that assuming a normal distribution? The mean and stdev for k = 1 are 12.12 and .34, for k = 100 (at max) its 9.26 and .36. Seems significant. Haven't tried intermediate values, k = 2 seemed to decrease performance, but I didn't do a careful study.

Yes, different trees. It does assume a normal distribution, but I think that's at least in the ballpark.

I'm not sure, but if going from k=1 to k=2+ produces a significantly different result, that seems strange. I'd probably spend some time trying to suss out bugs. Like what if you do k=2 and only consider the 2nd point, so there's still only 1 point in your kernel density? Or what if you do k=1 but then feed two of that point into your kernel density?