-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Predictions: Allow choosing a target #5790
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5790 +/- ##
==========================================
+ Coverage 86.23% 86.27% +0.03%
==========================================
Files 315 315
Lines 66617 66774 +157
==========================================
+ Hits 57447 57608 +161
+ Misses 9170 9166 -4 |
What if:
|
What about this? I replaced the listview with a combo and moved everything to main area. This not only gets rid of the empty control area and makes everything nicer, it also simplifies the widget and its code. The listview contained all classes that appeared in the data or in any of the models. So the user was able to choose any combination of classes, including, say, some classes that only appeared in some models. I doubt anybody used this, so the list was a nuissance. Why would anybody be interested in setosa and virginica, but not versicolor? Now the combo offers only sensible options: no probabilities, probabilities that appear in the data, probabilities that are predicted by models (which may differ from those in the data) and probabilities of individual classes that appear in the data. No combinations. The widget did not work with contexts: it couldn't, because the context would be an ordered combinations of all classes appearing in any model (because this is what list view offered). Now, the context is simply the list of classes in data. |
@janezd, I like the concept, but your new approach trades valuable vertical space for (cheap an collapsible) horizontal. Substantially decreasing margins around components would likely make me stop complaining. |
136dafc
to
0843b72
Compare
@markotoplak, you're right. Is this better? For numeric target, I could move Restore Original Order below the table to eliminate the components above, but this could be confusing. |
Looks good! I do not know about the Qt quirks about this one, but the upper control pane still has larger margins than the lower one. I agree that moving the button could be confusing. |
9571d1f
to
69c5f5c
Compare
It turns out that it was not a Qt's quirk: if is_macstyle():
btnpaddingbox = vBox(widget, margin=0, spacing=0)
separator(btnpaddingbox, 0, 4) # lines up with a WA_LayoutUsesWidgetRect checkbox
button.outer_box = btnpaddingbox Ready for review. |
70a313c
to
c1604c3
Compare
Hahaha, so all our buttons are adding padding that can not be disabled just so that they align with potential checkboxes? Who merged that? Wait, it was me. :) |
Hm... 🤪 |
self.shown_probs = self.DATA_PROBS | ||
self.target_class = self.TARGET_AVERAGE | ||
else: | ||
self.shown_probs = self.NO_PROBS |
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 not adding MODEL_PROBS option in this case (for classification)?
In previous version of the widget the probabilities were shown despite missing target.
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.
Huh, I could but this would complicate the code and the widget.
- In terms of UX, allowing
MODEL_PROBS
when the data class is continuous but some models are categorical would require showing the combo, which would then have two options,NO_PROBS
andMODEL_PROBS
. When all models are regressors, the combo would be hidden... - In terms of the code, I can now simply expect that
shown_probs
isNO_PROBS
in case of numeric data, which simplifies some conditions, as I remember.
Though I could change this, I'd prefer not to. This situation is too strange; perhaps we could even ignore models of wrong kind and show a warning.
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, leave it as is. But be aware that, in e.g. six months, one may report an issue: Predictions widget is missing probabilities. :)
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.
We'll tell him that he should not mix classifiers and regressors. :)
# because one commit button has only one dirty flag, and unnecessarily | ||
# making an unconditional commit af a small table is better than | ||
# conditionally commit all predictions. | ||
self._commit_evaluation_results() |
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? How is the output target_class
dependent?
But, if it is dependent, the (target) combo box should not be hidden.
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.
Good catch. I assumed that the output depends on what is shown, but it does not.
I now fixed that. The output table now contains the same data as shown in the view. And thus depend on the combo. This is relevant only for classification, so combo can still be hidden for regression.
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 was actually referring to the Evaluation results output.
I don't see how those depend on the target combo box.
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.
Oh, you're right. I removed the comment and the function call.
"and are known to the model" | ||
else: | ||
class_idx = self.shown_probs - len(self.PROB_OPTS) | ||
text += f"'{self.class_var.values[class_idx]}'" |
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.
The target_class
value is missing in the report.
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.
Fixed.
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.
Are you sure you want to display it for regression as well?
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.
Sure not.
034ceab
to
12ab88a
Compare
@VesnaT, thanks for this detailed review. Some changes are substantial (those related to output), so I've put all today's changes into a new commit. Please use Squash & Merge for merging. |
Here's a workflow to explore the behaviour of the output. |
I've found another minor issue, but it might had been there before:
|
a2a4338
to
5fbd250
Compare
Quite probably. The argument for order was missing when sorting after changing indices: https://github.com/biolab/orange3/pull/5790/files#diff-dd77f983a656d8fa3f453496f08aad0ae7e8c5a57e48406d5520836c76ce1690R1040. The changes were so minor (removed call to resend signals; |
The sort indicator is now shown on the first column by default, which is not ok. |
5fbd250
to
429fd85
Compare
True, but without "now". This misbehaviour is old. This should fix it: https://github.com/biolab/orange3/pull/5790/files#diff-dd77f983a656d8fa3f453496f08aad0ae7e8c5a57e48406d5520836c76ce1690R523. |
Issue
Fixes #5743.
Description of changes
It sure looks funny, especially for numeric targets, but.
I didn't want to put the combo to the main area in order to save space; in Test and Score we have plenty space on the right, here it's precious. I have put the Restore Order button and the list view for selecting probabilities at the top, and the combo for choosing the target at the bottom (with rubber in between), so they are close to their respective tables.
This is quite nice for discrete outcomes; less so for numeric.
I've no idea what to do here except for perhaps having a different layout in this case: just put the checkbox and the button between the tables (in that order, with rubber between), and hide the control area completely.
Includes