Skip to content
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

Merged
merged 7 commits into from
Sep 9, 2022
Merged

Conversation

ElenaPetrunina
Copy link
Contributor

  • 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
import skfda.preprocessing.smoothing.validation as val
from skfda.preprocessing.smoothing import KernelSmoother
from skfda.misc.kernels import uniform

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 (

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

Copy link
Contributor Author

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?

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks

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,

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.kernels import uniform
from skfda.misc.hat_matrix import (
NadarayaWatsonHatMatrix,
LocalLinearRegressionHatMatrix,

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,

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,
)

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

dist = fd.grid_points[0][1] - fd.grid_points[0][0]
bandwidth = np.linspace(
dist,
dist*((n_neighbors[-1] - 1)//2),

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

dist = fd.grid_points[0][1] - fd.grid_points[0][0]
bandwidth = np.linspace(
dist,
dist*((n_neighbors[-1] - 1)//2),

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

bandwidth = np.linspace(
dist,
dist*((n_neighbors[-1] - 1)//2),
len(n_neighbors)

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
Copy link

codecov bot commented Aug 29, 2022

Codecov Report

Merging #473 (4a5efb5) into develop (1530288) will not change coverage.
The diff coverage is n/a.

@@           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.

Copy link
Member

@vnmabus vnmabus left a 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.

dataset = skfda.datasets.fetch_phoneme()
fd = dataset['data'][:300]

fd[:5].plot()
out = fd[:5].plot()
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks.

@vnmabus vnmabus merged commit 3c62e31 into develop Sep 9, 2022
@vnmabus vnmabus deleted the fetaure/kernel_smoother_example branch August 17, 2023 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants