tommyod / KDEpy

Kernel Density Estimation in Python
https://kdepy.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
576 stars 89 forks source link

Return the value of bandwidth defined automatically with ISJ method #120

Closed marco-rosso-m closed 1 year ago

marco-rosso-m commented 1 year ago

Hi, thanks for the python package it is the best and fast implementation of KDE in python.

However, I was wondering if there is a simple way to return the value of the bandwidth automatically determined from the method ISJ or also from another method. I need to get this value and save it in a variable after run the FFTKDE command.

Thank you in advance

KaizerJ commented 1 year ago

I know this issue is closed but if anyone has the same question, you can access the class property bw after fitting:

X = df['anything'].to_numpy().reshape(-1,1)
kde = FFTKDE(kernel='gaussian', bw='ISJ')
x, y = kde.fit(X).evaluate()

kde.bw
marco-rosso-m commented 1 year ago

Yes, thank you very much! I had discovered how to access it after studying a little bit deeper you code.

It a very clear and fast code, all my sincerely admiration to your work!

Thank you very much anyway

Best regards

Marco Martino Rosso

ArtIStE - Artificial Intelligence in Structural Engineeringhttp://www.civilml.polito.it/

e-mail: @.**@.>

Personal Websitehttp://rossomarcomartino.flazio.com/

PhD Student in Structural Civil Engineering at Politecnico di Torino

https://aka.ms/AAb9ysg


From: KaizerJ @.> Sent: Wednesday, April 5, 2023 4:22:11 PM To: tommyod/KDEpy @.> Cc: Marco Martino Rosso @.>; State change @.> Subject: Re: [tommyod/KDEpy] Return the value of bandwidth defined automatically with ISJ method (Issue #120)

I know this issue is closed but if anyone has the same question, you can access the class property bw after fitting:

`X = df['anything'].to_numpy().reshape(-1,1) kde = FFTKDE(kernel='gaussian', bw='ISJ') x, y = kde.fit(X).evaluate()

kde.bw`

— Reply to this email directly, view it on GitHubhttps://github.com/tommyod/KDEpy/issues/120#issuecomment-1497576704, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWOAWTJRYR45CE4SVKWBSS3W7V5ZHANCNFSM6AAAAAARZYZHTM. You are receiving this because you modified the open/close state.Message ID: @.***>

KaizerJ commented 1 year ago

Im not author of this work, just had same question and wanted to make it easier to anyone who may have it in the future :)