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

Unmark sklearn.metrics.mean_squared_error and mean_squared_log_error as deprecated #319

Merged
merged 2 commits into from
Oct 22, 2024
Merged

Conversation

InSyncWithFoo
Copy link
Contributor

Instead, two @deprecated overloads were added with helpful messages to specify that only squared is deprecated.

Resolves #318.

@debonte
Copy link
Contributor

debonte commented Oct 21, 2024

@InSyncWithFoo, as far as I can tell, Pylance doesn't have any support for deprecated overloads and PEP 702 explicitly chose to not add a way to deprecate parameters.

I'm not sure the added complexity of overloads here is worthwhile. What do you think about just removing the @deprecated decorators?

@InSyncWithFoo
Copy link
Contributor Author

InSyncWithFoo commented Oct 21, 2024

Pylance doesn't have any support for deprecated overloads [...]

What do you mean? Deprecated overload usages are explicitly specified to be errors and Pyright is able to report them as such (playground):

@deprecated("Foobar")
@overload
def f(v: int, *, b: bool) -> None: ...

@overload
def f(v: int) -> None: ...
f(0, b = False)  # error: The function "f" is deprecated
f(0)             # fine

While it is true that there is no Deprecated[] modifier, this limitation can be overcome by using @overloads, and I don't see any reason not to do so.

@debonte
Copy link
Contributor

debonte commented Oct 22, 2024

Thanks. I'm not sure why I wasn't seeing this work before, but I see the diagnostic hint now.

The error text is a bit misleading since it starts off by saying that the function is deprecated, but as long as they keep reading through the descriptive text you added users should be ok.
image

Thanks for the contribution.

@debonte debonte merged commit b46b33f into microsoft:main Oct 22, 2024
3 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.

sklearn.metrics.mean_squared_error and mean_squared_log_error are not deprecated
2 participants