[ENH] Update meta classes and add unit tests#107
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #107 +/- ##
==========================================
+ Coverage 82.68% 84.09% +1.40%
==========================================
Files 32 34 +2
Lines 2322 2383 +61
==========================================
+ Hits 1920 2004 +84
+ Misses 402 379 -23 ☔ View full report in Codecov by Sentry. |
fkiraly
left a comment
There was a problem hiding this comment.
Ah yes, I forgot to port this. Good spot.
|
maybe one thing for you to review, whether you like (or not) the implied inheritance order. |
Do you mean in downsteram usage? class SomePipeline(BaseMetaObject, BaseObject):
... |
|
@fkiraly I'm going to leave this open for a bit and add unit tests of this functionality. For ease, can you point me to related |
Yes. One issue that for me has recently come up is that the meta-estimator can be a In either case, it makes sense to implement default functionality for the parameter getters I've been moving back and forth in this PR as it was one of the outstanding base framework issues in Not sure whether there is a better way, at least under this downstream usage.
Yes, correct - most of the coverage comes from integration tests which require the functionality in the mixin to work correctly in order to pass. There are further punctual tests when it comes to the specific tag behaviour of things like pipelines, or logic of the meta-class child. I also do not think there are any direct tests, but I might be mistaken. |
I'm thinking we might want want 2 mixins.
From a user perspective, we'd document that the choice of the mixin to use is dependent on whether your building a meta object or meta estimator, which seems straight-forward enough. For example: from skbase.base import BaseEstimator, BaseMetaestimator, BaseMetaObject, BaseObject
class SomeNeatMetaObject(BaseMetaObject, BaseObject):
...
class SomeNeatMetaEstimator(BaseMetaEstimator, BaseEstimator):
...From a maintenance perspective, we'd have the same functionality and not double anything up. I'll work up this and some integration tests today. |
I suppose that makes sense, assuming they are clearly presented as mixins. Not more complex to the user than the alternatives. |
|
|
||
| @overload | ||
| def make_strings_unique(str_list: Tuple[str, ...]) -> Tuple[str, ...]: | ||
| ... # pragma: no cover |
Check notice
Code scanning / CodeQL
Statement has no effect
|
|
||
| @overload | ||
| def make_strings_unique(str_list: List[str]) -> List[str]: | ||
| ... # pragma: no cover |
Check notice
Code scanning / CodeQL
Statement has no effect
|
|
||
| @overload | ||
| def _check_names(self, names: List[str], make_unique: bool = True) -> List[str]: | ||
| ... # pragma: no cover |
Check notice
Code scanning / CodeQL
Statement has no effect
| def _check_names( | ||
| self, names: Tuple[str, ...], make_unique: bool = True | ||
| ) -> Tuple[str, ...]: | ||
| ... # pragma: no cover |
Check notice
Code scanning / CodeQL
Statement has no effect
Reference Issues/PRs
Fixes #106.
What does this implement/fix? Explain your changes.
This PR will add unit tests of the meta class functionality. It will also provide an update of the provided functionality to make it generally consistent with
skbasedesign principles.Does your contribution introduce a new dependency? If yes, which one?
No new dependencies.
What should a reviewer concentrate their feedback on?
Updates to BaseMetaObject (renamed from BaseMetaEstimator) and whether tests cover reasonable use-cases.