-
Notifications
You must be signed in to change notification settings - Fork 0
✨ Add callable features and better error testing #26
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
|
Thanks @EssamWisam for this. I can review early next week. |
src/generic.jl
Outdated
| """ | ||
| function generic_fit(X, | ||
| features::AbstractVector{Symbol} = Symbol[], | ||
| features::Union{AbstractVector{Symbol}, Function} = Symbol[], |
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.
Callables do not need to be functions. You can make instances of any new struct a callable. Unless you need it for type dispatch, there is no need to annotate a type here.
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.
Done in 194c53e
| # Original behavior for vector of symbols | ||
| feat_names = (ignore) ? setdiff(feat_names, features) : intersect(feat_names, features) | ||
| end | ||
|
|
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.
In Julia it is unfortunately difficult to recognise callability of an object (at least last time I researched this). So, reverse your logic here: if feature names is a vector of symbols then do X, otherwise do Y.
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.
Here's an example of a callable that is not a function:
struct Foo end
(::Foo)(x) = 2x
f = Foo()
f(4) # 8
f isa Function # false
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.
Done in 5e0af90
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.
Thanks for this. It's good to have this extra features.
Appreciate the detailed error catching cleanup. Makes it easier to tweak error messages in the future.
Co-authored-by: Anthony Blaom, PhD <[email protected]>
Co-authored-by: Anthony Blaom, PhD <[email protected]>
|
Re 1.6 fail: Since 1.10 is the new LTS release, you can bump julia compat to 1.6 and in CI.yml change 1.6 to 1.10. |
|
Will get back to this soon just nearing a flight. |
It doesn't sound quite intuitive to me 😊 (since the version numbers are different) but I did that. |
|
My bad. I meant bump compat to julia=1.10. You also have some conflict to resolve. |
|
One final question. At the user interface point, can she specify |
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.
Ready to rock and roll 🎶
Thank you for this valuable contribution, @EssamWisam
|
Thank you will merge now and consider any last PR needed before publishing package. |
Closes #2 and #11