Skip to content

Commit

Permalink
Calibration plot: Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
janezd committed Jun 24, 2019
1 parent 2049afa commit 04d05f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions Orange/widgets/evaluate/owcalibrationplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,9 @@ def threshold_change(self):
self._update_info()

def _update_info(self):
def elided(s):
return s[:17] + "..." if len(s) > 20 else s

text = f"""<table>
<tr>
<th align='right'>Threshold: p=</th>
Expand All @@ -416,7 +419,7 @@ def _update_info(self):
for name, (probs, curves) in self.scores:
ind = min(np.searchsorted(probs, self.threshold),
len(probs) - 1)
text += f"<tr><th align='right'>{name}:</th>"
text += f"<tr><th align='right'>{elided(name)}:</th>"
text += "<td>/</td>".join(f'<td>{curve[ind]:.3f}</td>'
for curve in curves)
text += "</tr>"
Expand All @@ -436,8 +439,8 @@ def apply(self):
(len(results.folds) > 1,
"each training data sample produces a different model"),
(results.models is None,
"test results do not contain stored models - try testing on"
"separate data or on training data"),
"test results do not contain stored models - try testing "
"on separate data or on training data"),
(len(self.selected_classifiers) != 1,
"select a single model - the widget can output only one"),
(self.score != 0 and len(results.domain.class_var.values) != 2,
Expand Down
2 changes: 1 addition & 1 deletion Orange/widgets/evaluate/tests/test_owcalibrationplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def test_apply_no_output(self, *_):
multiple_folds:
"each training data sample produces a different model",
no_models:
"test results do not contain stored models - try testing on"
"test results do not contain stored models - try testing on "
"separate data or on training data",
multiple_selected:
"select a single model - the widget can output only one",
Expand Down

0 comments on commit 04d05f4

Please sign in to comment.