-
Notifications
You must be signed in to change notification settings - Fork 8
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
Provide a range for basis #191
Conversation
TODO
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## development #191 +/- ##
===============================================
- Coverage 97.23% 97.10% -0.13%
===============================================
Files 15 18 +3
Lines 1484 1626 +142
===============================================
+ Hits 1443 1579 +136
- Misses 41 47 +6 ☔ View full report in Codecov by Sentry. |
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.
Basic ideas here all look good to me, but I've got some higher level questions:
- Not sure how I feel about setting just one of vmin/vmax. Picking vmin+1 / vmax-1 feels very arbitrary. why not require both? we could do that by changing the argument to
vrange
and requiring it to be a 2-tuple - this PR pulls the eval and conv modes of the basis further apart. do we want to consider making them separate classes? or something else, but it feels weird to have fully half of the arguments be ignored in one mode and the other half in the other mode.
- not necessarily part of this PR, but: I don't know how to pull up the docstring of
__call__
. what comes up is the docstring of the class. that seems ... like a problem. if I'm missing something, let me know, otherwise I can create an issue - for the raised cosine basis objects, they only give reasonable values on the interval [0,1]. So vmin/vmax should lie within that interval as well.
- for those objects, it's weird that the log never rescales and the linear can optionally do so. shouldn't they both always rescale? did we discuss this at some point? the other basis objects never rescale, right? but it feels like rescaling means something different
src/nemos/basis.py
Outdated
sample_pts, knot_locs, order=self.order, der=0, outer_ok=False | ||
) | ||
else: | ||
basis_eval = np.full((sample_pts.shape[0], self.n_basis_funcs), np.nan) |
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'm confused as how this can be hit, if we raise a ValueError
if all sample points lie outside vmin/vmax
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.
(note this shows up in multiple basis objects)
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.
yep, It wasn't the case at the beginning but then I changed my mind and this is a leftover
src/nemos/basis.py
Outdated
------- | ||
basis_funcs : | ||
Raised cosine basis functions, shape (n_samples, n_basis_funcs). | ||
rescale_samples : |
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.
why is this only an option for this basis?
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 realize this isn't new, but it feels odd, given the new behavior
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.
also the docstring says that it rescales to 0,1, but now it depends on vmin/vmax
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.
removed, and added a private flag at init that define if the RaisedCosineLinear should rescale or not (if called by the subclass it should not, otherwise it always have to)
Co-authored-by: William F. Broderick <billbrod@gmail.com>
This has been addressed (
We should discuss this with Sofia and @gviejo. But definitely not something we should tackle in this PR.
Interesting...
This has been resolved. RaisedCosineLinear should always be called with the rescale_sample flag set to true. The Log instead must call the super class call with the rescale_sample set to False.
They both have a single possible behavior, I was exposing the parameter by mistake. |
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 have a couple points dropped throughout that I think need addressing, basically juts by adding a comment, but then I think this is good to go. I think using a single bounds
argument is much cleaner.
Co-authored-by: William F. Broderick <billbrod@gmail.com>
Co-authored-by: William F. Broderick <billbrod@gmail.com>
Co-authored-by: William F. Broderick <billbrod@gmail.com>
Co-authored-by: William F. Broderick <billbrod@gmail.com>
Co-authored-by: William F. Broderick <billbrod@gmail.com>
Setting basis range
This PR addresses #178, allowing to set a fixed range for the basis.
This is a useful when,
The vmin/vmax are set at initialization of the basis, so that multiple calls to
Basis.compute_features
will return same result every time and do not require extra arguments.vmin and vmax are get only properties.
Behavior of (
__call__
andcompute_features
):Behavior of
evaluate_on_grid
(differs since it does not receive any sample):