[SciPy-User] changing covariance factor in scipy.stats.kde.gaussian_kde
Carolin Villforth
carovi at utu.fi
Mon Dec 6 13:47:12 EST 2010
Hello,
I have a question concerning the usage of gaussian_kde. I am trying to change the covariance factor for the KDE, this is what I am doing it at the moment:
myKDE = scipy.stats.kde.gaussian_kde(data)
myKDE.covariance_factor = myKDE.silverman_factor
myKDE._compute_covariance()
The last line seems to be necessary for the changes to take effect.
While the above code works, this might create quite an overhead since _compute_variance is executed twice, once in __init__ and then again after the covariance factor has been changed. If I understood correctly, this is not really necessary since silverman_factor does not depend on outputs from _compute_covariance. Also, I always assumed that one should avoid calling '._functions' from outside the class.
Is there another way to change the covariance factor?
Thanks
Greetings
Carolin
----------------------------------------------------------
Carolin Villforth
PhD Student
Tuorla Observatory Finland and
Space Telescope Science Institute
3700 San Martin Drive
21218 Baltimore, MD
USA
phone: +1-410-338-4334
email: carovi at utu.fi, villfort at stsci.edu
----------------------------------------------------------
More information about the SciPy-User
mailing list