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 RMSE, MSLE to handle missing values #542

Merged
merged 15 commits into from
Dec 23, 2024
Merged

Update RMSE, MSLE to handle missing values #542

merged 15 commits into from
Dec 23, 2024

Conversation

DanilSmorchkov
Copy link
Collaborator

@DanilSmorchkov DanilSmorchkov commented Dec 23, 2024

Before submitting (must do checklist)

  • Did you read the contribution guide?
  • Did you update the docs? We use Numpy format for all the methods and classes.
  • Did you write any new necessary tests?
  • Did you update the CHANGELOG?

Proposed Changes

See #526

Closing issues

Closes #526.

@DanilSmorchkov DanilSmorchkov self-assigned this Dec 23, 2024
@d-a-bunin d-a-bunin self-requested a review December 23, 2024 07:40
Danil Smorchkov added 2 commits December 23, 2024 10:45
# Conflicts:
#	etna/metrics/__init__.py
#	etna/metrics/functional_metrics.py
#	tests/test_metrics/test_metrics.py
Copy link

github-actions bot commented Dec 23, 2024

🚀 Deployed on https://deploy-preview-542--etna-docs.netlify.app

@github-actions github-actions bot temporarily deployed to pull request December 23, 2024 08:01 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 23, 2024 08:13 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 23, 2024 08:21 Inactive
CHANGELOG.md Outdated Show resolved Hide resolved
etna/metrics/functional_metrics.py Outdated Show resolved Hide resolved
tests/test_metrics/test_functional_metrics.py Outdated Show resolved Hide resolved
tests/test_metrics/test_functional_metrics.py Show resolved Hide resolved
etna/metrics/functional_metrics.py Show resolved Hide resolved
@github-actions github-actions bot temporarily deployed to pull request December 23, 2024 08:27 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 23, 2024 09:07 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 23, 2024 09:42 Inactive
A non-negative floating point value (the best value is 0.0), or an array of floating point values,
one for each individual target.
"""
mse_result = np.asarray(mse(y_true=y_true, y_pred=y_pred, multioutput=multioutput))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you use np.asarray here?

Copy link
Collaborator Author

@DanilSmorchkov DanilSmorchkov Dec 23, 2024

Choose a reason for hiding this comment

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

To avoid typing errors from mypy.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure if it is ok. In multioutput="joint" the result should be float, but np.asarray makes it smth like np.array([value]) instead of value.
I thought that we have tests that check that.

Copy link
Collaborator Author

@DanilSmorchkov DanilSmorchkov Dec 23, 2024

Choose a reason for hiding this comment

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

Yes, but np.sqrt makes from np.array(value) to np.float64.
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

  • We tested that current behavior is ok.
  • It could be not so obvious for other readers why do we use np.asarray.
  • Where exactly mypy is raising error? In some other functional metrics we just put type: ignore at the last line to ignore the mypy.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

error: Incompatible return value type (got "ndarray[Any, dtype[Any]]", expected "Union[float, Sequence[float], Sequence[Sequence[float]]]")  [return-value]

Got it, I'll try to use type: ignore

Copy link

codecov bot commented Dec 23, 2024

Codecov Report

Attention: Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.

Project coverage is 90.48%. Comparing base (ac792f8) to head (b9b63bd).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
etna/metrics/functional_metrics.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #542      +/-   ##
==========================================
- Coverage   90.49%   90.48%   -0.01%     
==========================================
  Files         256      256              
  Lines       17364    17373       +9     
==========================================
+ Hits        15713    15720       +7     
- Misses       1651     1653       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions github-actions bot temporarily deployed to pull request December 23, 2024 10:29 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 23, 2024 12:15 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 23, 2024 12:58 Inactive
@DanilSmorchkov DanilSmorchkov merged commit 7b37537 into master Dec 23, 2024
17 checks passed
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.

Update RMSE, MSLE to handle missing values
2 participants