-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: adds residual vs fitted plotting function #100
Conversation
fix: corrects typo in docstring
Codecov Report
@@ Coverage Diff @@
## master #100 +/- ##
=======================================
Coverage 96.69% 96.69%
=======================================
Files 12 12
Lines 787 787
=======================================
Hits 761 761
Misses 26 26
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
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, @byooooo .
The only thing I'd recommend to change is that we indent the "Defaults to" in the docstrings.
pyepal/plotting/__init__.py
Outdated
Defaults to "objective [index]". | ||
figsize (tuple, optional): Figure size for each individual residual | ||
vs fitted objective plot. | ||
Defaults to (6.0, 4.0). |
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 feel there should be an indent for "Defaults to"
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.
just fixed
pyepal/plotting/__init__.py
Outdated
labels (Union[List[str], None], optional): [description]. Defaults to None. | ||
figsize (tuple, optional): [description]. Defaults to (8.0, 6.0). | ||
labels (Union[List[str], None], optional): Labels for each objective. | ||
Defaults to "objective [index]". |
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.
probably also needs an indent 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.
just fixed
|
||
Returns: | ||
fig | ||
""" | ||
|
||
num_targets = y.shape[1] | ||
fig, ax = plt.subplots( # pylint:disable=invalid-name | ||
num_targets, num_targets, figsize=figsize | ||
num_targets, num_targets, figsize=figsize, tight_layout=True |
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.
something we do not have to fix here but In the function above the figsize argument behaves differently
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.
yea i thought it made more sense to set the figsize individually for that function and have it auto-adjust by multiplying it based on the number of objectives. probably not good if we want to be consistent with the other function. it didn't make sense to do that for this function since the figure size for each individual subplot will be very small
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.
ok, we can maybe describe these behaviors in the docstrings
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.
ah it is already there, sorry!
@@ -166,6 +166,63 @@ def plot_histogram(y: np.ndarray, palinstance, ax): # pylint:disable=invalid-na | |||
) | |||
|
|||
|
|||
def plot_res( # pylint:disable=invalid-name | |||
y: np.array, | |||
palinstance, |
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 not important for this PR, but we might want to do this in a future enhancement: We should also annotate the other types in the functions
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.
sounds good
Probably we can add in another PR simple tests for the plotting functions. This is, we won't check if the plots look correct but at least make sure that no error is thrown if we use the functions (might be relevant if we change some of the PALBase API) |
yea actually i was wondering where the unit tests were for this. If you want, i can add it as well |
i didn't write test as i wasn't sure what is the best way to test plotting functions. But we might add some that just check that a non-empty figure is returned with correct number of subplots ... but we I can make a separate PR for that later today |
Types of changes
addresses #72
Actions (for code changes)