forecasting refactor: removing _SktimeForecaster and horizon mixins#1088
forecasting refactor: removing _SktimeForecaster and horizon mixins#1088
Conversation
|
So, it would appear we have a problem with grid search and descendants. FZI, @aiwalter, @GuzalBulatova, @mloning, @TonyBagnall. The problem is not in the refactoring, but that the grid search even before refactor seems to have implemented polymorphic behaviour regarding the "requires fh in fit" property. That is, it was behaving as if that tag was dynamically set (by delegation). Since the refactor makes this more explicit by defaulting to base logic, this no longer works, and, depending on the setting of the fh tag, either breaks in testing when the inner forecaster can´t deal with fh in fit, or in many places (including examples) because it starts to require fh in fit per the tag. I see three feasible solutions here:
Any opinions or other options, @aiwalter, @GuzalBulatova, @mloning , @TonyBagnall? |
|
Hi @fkiraly, I looked at the failing test when setting I have implemented that in PR #1092, let me know what you think? |
I would prefer a solution where we do not delegate the I prefer a solution where changes to the base class on the top level In addition, I think that it makes sense for the wrapping and the wrapped estimators to keep track of
These complications are what leads to unnecessary overrides, in my opinion. What makes much more sense, i.m.o., is to delegate |
|
I've skimmed through the discussions and unfortunately I do not know/understand enough about BaseGridSearch to make an informed decision. After a first glance at fk's PR 1091, I lean towards it being 'over-engineered' and it is tricky to work out what exactly what is going on. The base class is suddenly filled with a lot of extra baggage. (note, I have only looked at base class so far...I'm not exaggerating when I say I can't make informed decision!). Markus' PR is nice at first glance becaue the changes are minimal and seem easier to understand. But Franz has pointed out some flaws in his comment above (which I do not fully understand). My instinct is that the 'best' way of doings things will be one which only changes BaseGridSearch without changing _base.py; whether that is Markus' solution or something else, I have no idea. My other instinct is that we should go with FK's solution only if we anticipate using the extra machinery elsewhere (maybe in #1079 ??) |
|
We can delegate to the internal methods, this avoid dynamic attribute delegation. I changed that in #1092 and it seems to work. Note that this
So it's also not perfect, but none are major points for me at this stage. I largely agree with @Lovkush-A's comments above. If we can avoid making this PR conditional on dynamic tags, I would strongly prefer so, as we haven't given that much thought (see #981). I think it's fine to use either option (attribute delegation or delegation to internal methods) for now, merge this, finish the first round of refactoring, make a release and then revisit the broader topics such as dynamic tags. We should also move some of the tests from |
This is actually my major concern! The dediated interface point for "requires the fh in fitting" diverges from its intended and explicitly stated meaning. So that the test passes is a consequence of the chosen default settings in testing, rather than actual correctness of the interface! I.e., there's both a problem with the test currently, as well as the proposed solution - but the test doesn't catch it since it has a problem (see above). I would strongly opine that my proposal is a principled way to fix this "broken interface" issue - and, currently, the only way that is on the table as an implemented solution. I'm happy to defer this until after the next release, but what I don't want is that we just indefinitely block the issue out by stalling discussion of it, and ultimately forget about it and never resolve it until something breaks and we have no idea why. |
|
Okay, let's defer this until after the next release. Can I merge my suggestions then in #1092?
I don't think any of us wants this. |
|
@mloning, no, let's get done with this :-) |
|
actually... here's a question: are major version steps based on breaking usage contracts, extension contracts, or internal contracts? Because the removal of the mixins and |
|
I think it's fine to go in, I'm not too worried about internal contracts, especially since there wasn't any documentation on it. Probably changes now that we have the extension templates. So feel free to merge once all tests pass. |
|
@fkiraly if you approve, you can merge |
|
Ah realised that you can't approve, so I merged now - that finishes the refactoring I believe, great work, the code looks a lot better now! |
Capstone item for refactor #955.
This removes the
SktimeForecasterand the two horizon mixins fromforecasting/_base/_sktime.py.This is because the temorary workaround of passthrough/tag inheritance is no longer needed, as all descendants have had these removed from their base classes as part of the #955 refactor.