-
Notifications
You must be signed in to change notification settings - Fork 1
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
Use traits to generalise apply methods #75
Comments
I think this is good to be thinking about but would like to see prototype of applying this to maybe Linearcombination or OneHotEncoding to prove testing is simplified without losing tests for edge cases |
I agree. I'm on board with the points of "We need a better way of structuring the package". The proposed solution looks alright. My biggest concern is
and a POC would give a better sense of that. I think we could still solve the over-testing problem without generalising things this cleanly, but it would be nice. |
Here is the POC for the above: #77 I'll note that after working on it, and iteratively refactoring, I realised there is no need for another level of abstraction for Practically speaking, this really only affects
|
Summary
We should define a
Cardinality
trait forTransform
s and appropriate intermediate_apply
method for each. We should also create dummyTransform
s to verify that types supporting thetransform
interface are compatible with any kind ofTransform
.Challenges
There are a few challenges in developing this package in it's current state:
LinearCombination
is a special case in that it has its ownapply
method, rather than just a more simple_apply
because of how it needs to modify the input data.LinearCombination
in the future: it will also likely need its ownapply
method.Transform
on all supported data types and thus over-testing the package, but we have had to do this to make sure we are catching all edge-cases.Transforms
for the same reason, which is extremely time-consuming and error-prone. WIP: support FeatureTransforms.jl AxisSets.jl#44LinearCombination
because of its unique behaviour.We need a better way of structuring the package so that
apply
methods._apply
method and the behaviour of the transform should be tested, which should be independent of the data type it's being used on.apply
/apply!
/apply_append
methods are required.Idea: A Cardinality Trait
The reason
LinearCombination
needs its ownapply
method is that it is a reduction operation, i.e. many-to-one, whereas (most of) the rest of the transforms are one-to-one.The only exception is
OneHotEncoding
, which is one-to-many and comes with other challenges (like how to treat matrix inputs).If we inspect the code, the difference is most easily recognised in the
tables
methods:It may be useful to define some interstitial level of abstraction between the
apply
method (for types) and_apply
method (forTransform
s) that treats the data according to the cardinality of theTransform
.The rough structure of that design would look like:
Further advantages of this approach:
apply!
could be explicitly restricted toOneToOne
transformsDummyOneToOneTransform
,DummyManyToOneTransform
, etc., against which to test new types rather than test allTransform
s.Notes
_apply
method for each new type?The text was updated successfully, but these errors were encountered: