-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[DOC] recipes for simple parameter change and deprecation management #5875
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
Conversation
yarnabrina
left a comment
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.
Will it be easier if this also has examples of an esimator pseudo-code (similar to extension templates) at 3 stages:
- before change
- during deprecation period
- after deprecation
?
|
hm, good idea! I would leave those to a separate PR though, since I have various things on my list. Feel free to add this if you have sth in mind, otherwise I'll return later? |
yarnabrina
left a comment
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 tried to see if Copilot can quickly generate examples, but it did not do as much as I had hoped. I edited it a bit, but it does not cover all cases that you noted. Keeping it here for future references.
Case 1: before change
class EstimatorName:
def __init__(self, old_parameter="old"):
self.old_parameter = old_parameter
def fit(self, X, y):
# Fit the model using old_parameter
pass
def predict(self, X):
# Predict using the fitted model
passCase 2: during deprecation
from sktime.utils.warnings import warn
class EstimatorName:
def __init__(self, old_parameter=None, new_parameter="new"):
# TODO (release x.y.z): remove the old_parameter argument and following check
if old_parameter is not None:
warn(
"'old_parameter' of `EstimatorName` is deprecated and will be removed"
" in the version '<MAJOR>.<MINOR>.0'. This has been renamed to "
" 'new_parameter', where you can pass 'old' to keep current behaviour."
" The new argument will use 'new' as its default value.",
category=DeprecationWarning,
obj=self,
)
self.new_parameter = old_parameter
else:
self.new_parameter = new_parameter
def fit(self, X, y):
# Fit the model using new_parameter
pass
def predict(self, X):
# Predict using the fitted model
passCase 3: after change
class FinalEstimator:
def __init__(self, new_parameter="new"):
self.new_parameter = new_parameter
def fit(self, X, y):
# Fit the model using new_parameter
pass
def predict(self, X):
# Predict using the fitted model
pass|
why don't we add the singe example then? Better than no examples. Not sure where (in the paragraph, or at the end, or on another page)? |
added examples of an esimator pseudo-code (similar to extension templates) at 3 stages - before change - during deprecation period - after deprecation
|
Ok, I added at end of the file, but please review for both content and rst formatting. |
|
looks good - can you rename "case" to "step"? "case" is usually either/or, for sequential items you use "step" or similar |
renamed `Case` to `Step`
This PR adds more details to the deprecation manual for simple pararmeter changes and deprecations, in the form of step-wise recipes.
This should help developers with spelling out the steps to carry out in detail.