[SciPy-User] smoothing in scipy/matplotlib

per freem perfreem@gmail....
Sun Jan 17 07:39:35 CST 2010


hi josef,

thank you so much - your patch worked brilliantly. i simply changed
the smoothing factor to 0.25 and got the correct result. it was very
straightforward to use! it would be great if your subclass of kde was
incorporated into scipy.

if you're interested in seeing the graphs before (with the default
kde) and with your version, i can send you those. thanks again.

On Sun, Jan 17, 2010 at 12:03 AM,  <josef.pktd@gmail.com> wrote:
> On Sat, Jan 16, 2010 at 11:37 PM,  <josef.pktd@gmail.com> wrote:
>> On Sat, Jan 16, 2010 at 6:33 PM,  <josef.pktd@gmail.com> wrote:
>>> On Sat, Jan 16, 2010 at 5:28 PM, per freem <perfreem@gmail.com> wrote:
>>>> hi all,
>>>>
>>>> i am using gaussian_kde to fit a gaussian kernel estimator to a bunch
>>>> of data. the lines i get are often quite jaggy and very sensitive to
>>>> fluctuations in the data. is there a way to "smooth" the estimate
>>>> more? typically in gaussian kdes there is a smoothing parameter, but i
>>>> do not see one in the documentation.
>>>>
>>>> is there a way to do this?
>>>
>>> Not yet, I never committed the change, the cleanest way currently is
>>> by subclassing kde_gaussian, the dirtier version is by monkey
>>> patching. I can look for my example scripts for both later tonight,
>>> there is also some information on the mailing list, e.g. a subclassing
>>> example by Anne (maybe one and a half years ago)
>>>
>>> I'm a bit surprised about undersmoothing, because I did the changes
>>> for the case of oversmoothing by kde_gaussian.
>>>
>>> Josef
>>
>> In the attachment is my subclass of  stats.gaussian_kde. the main
>> point I did was to allow to set or reset the smoothing factor to a
>> float. It plots several examples
>>
>> Initially this was intended to be a continuation to this story, but I
>> never got around to finishing it (my file is dated may, and I haven't
>> looked at it in a long time)
>>
>> http://jpktd.blogspot.com/2009/03/using-gaussian-kernel-density.html
>>
>> I hope this helps, ask if something is not clear.
>>
>> I don't find a ticket or mailinglist thread on my draft for the
>> enhancement (keyword option for bandwith) to gausssian_kde, the
>> initial monkey patch version is here
>> http://mail.scipy.org/pipermail/scipy-user/2009-January/019201.html
>>
>> Josef
>
> I just created http://projects.scipy.org/scipy/ticket/1092 so I don't
> forget about it again.
>
> I appreciate any comments about what changes would be useful for the
> bandwidth choice.
>
> Josef
>
>
>>
>>
>>>
>>>
>>>
>>>>
>>>> thanks.
>>>> _______________________________________________
>>>> SciPy-User mailing list
>>>> SciPy-User@scipy.org
>>>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>>>
>>>
>>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>


More information about the SciPy-User mailing list