-
Notifications
You must be signed in to change notification settings - Fork 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
Contigency table visual representation for notebooks #775
Conversation
Hi @arshiaar. We had discussed some adjustments to the dataframe labels. Can you please indicate if you plan to continue this PR to implement them? If not, that is completely fine, I will happily progress the work from here, but I wanted to give you the chance to let us know if you'd prefer to do this yourself. |
446a254
to
7144710
Compare
I have rebased this work (brought it up to date against the 'develop' branch) and pushed up that change into this PR. |
Modify column and row labels for HTML rendered contingency table Update contigency table tutorial to match.
@nicholasloveday This PR is now at a review-ready state. |
@arshiaar I removed the _repr_html method. As a side note, it needs to be named repr_html to be recognised by JupyterLab. However, the function doesn't work in all cases. If any dimensionality has been preserved, the confusion matrix is no longer 2x2. As such, I thought it was perhaps not ideal to have as default rendering function. I'm not entirely sure how higher-dimensional confusion matrixes should be handled, so I just removed it as a default renderer and put a note in the docstring, which I think is sufficient. I think a lot of the use cases will still be met, and this is a nice representation of the most common 2x2 case. Thanks again for all your help. |
This looks to work nicely for the 2x2 case. For higher dimensions, people can do something like new_manager = contingency_manager.transform(preserve_dims='lead_hour')
new_manager.get_table() It doesn't display a nice table, but it people can access the data and make their own tables. One thing that would be nice to do is to provide a more useful error message if you call new_manager = contingency_manager.transform(preserve_dims='lead_hour')
new_manager.format_table() |
Thanks Nick. I had been wondering about whether to go to the extra effort to provide some more error-handling, and in light of your comments I will do so, and post here when I have something implemented. |
@nicholasloveday I have updated the PR with some additional handling code - what do you think? |
Thanks - the update looks good to me! |
Please work through the following checklists. Delete anything that isn't relevant.
Development for new xarray-based metrics
Docstrings
Tutorial notebook
-[x] update tutorial notebook