-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update plot_kernel_smoothing.py #473
Conversation
ElenaPetrunina
commented
Aug 29, 2022
- Fix runtime warning (division by zero)
- Change bandwidth values in CV parameter search
- Reorder sections
* Fix runtime warning (division by zero) * Change bandwidth values in CV parameter search * Reorder sections
examples/plot_kernel_smoothing.py
Outdated
import skfda.preprocessing.smoothing.validation as val | ||
from skfda.preprocessing.smoothing import KernelSmoother | ||
from skfda.misc.kernels import uniform |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
I001 isort found an import in the wrong position
import skfda.preprocessing.smoothing.validation as val | ||
from skfda.preprocessing.smoothing import KernelSmoother | ||
from skfda.misc.kernels import uniform | ||
from skfda.misc.hat_matrix import ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
I001 isort found an import in the wrong position
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed the imports (and run isort in local) and they looks ordered to me. I am missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will merge it and take a look at that later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks
examples/plot_kernel_smoothing.py
Outdated
import skfda.preprocessing.smoothing.validation as val | ||
from skfda.preprocessing.smoothing import KernelSmoother | ||
from skfda.misc.kernels import uniform | ||
from skfda.misc.hat_matrix import ( | ||
NadarayaWatsonHatMatrix, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
I001 isort found an import in the wrong position
examples/plot_kernel_smoothing.py
Outdated
from skfda.misc.kernels import uniform | ||
from skfda.misc.hat_matrix import ( | ||
NadarayaWatsonHatMatrix, | ||
LocalLinearRegressionHatMatrix, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
I001 isort found an import in the wrong position
from skfda.misc.hat_matrix import ( | ||
NadarayaWatsonHatMatrix, | ||
LocalLinearRegressionHatMatrix, | ||
KNeighborsHatMatrix, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
I001 isort found an import in the wrong position
NadarayaWatsonHatMatrix, | ||
LocalLinearRegressionHatMatrix, | ||
KNeighborsHatMatrix, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
I001 isort found an import in the wrong position
examples/plot_kernel_smoothing.py
Outdated
dist = fd.grid_points[0][1] - fd.grid_points[0][0] | ||
bandwidth = np.linspace( | ||
dist, | ||
dist*((n_neighbors[-1] - 1)//2), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
E226 missing whitespace around arithmetic operator
examples/plot_kernel_smoothing.py
Outdated
dist = fd.grid_points[0][1] - fd.grid_points[0][0] | ||
bandwidth = np.linspace( | ||
dist, | ||
dist*((n_neighbors[-1] - 1)//2), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
E226 missing whitespace around arithmetic operator
examples/plot_kernel_smoothing.py
Outdated
bandwidth = np.linspace( | ||
dist, | ||
dist*((n_neighbors[-1] - 1)//2), | ||
len(n_neighbors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
C815 missing trailing comma in Python 3.5+
Codecov Report
@@ Coverage Diff @@
## develop #473 +/- ##
========================================
Coverage 84.88% 84.88%
========================================
Files 135 135
Lines 10680 10680
========================================
Hits 9066 9066
Misses 1614 1614 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome improvement! It has a more logical structure and you managed to simplify the parts that were overly complex.
Just one minor nitpick and it is ready to merge after fixing the import order and style.
examples/plot_kernel_smoothing.py
Outdated
dataset = skfda.datasets.fetch_phoneme() | ||
fd = dataset['data'][:300] | ||
|
||
fd[:5].plot() | ||
out = fd[:5].plot() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to leave without assignment AND add a plt.show()
afterwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks.
* All out removed * Small changes in the text