Skip to content

Commit 3d91ec4

Browse files
janezdastaric
authored andcommitted
Merge pull request biolab#1832 from ajdapretnar/error-message
Error message for multitarget prediction (cherry picked from commit 3b6751d)
1 parent 917be20 commit 3d91ec4

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

Orange/widgets/evaluate/owtestlearners.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,17 +165,18 @@ class OWTestLearners(OWWidget):
165165
class_selection = settings.ContextSetting(TARGET_AVERAGE)
166166

167167
class Error(OWWidget.Error):
168-
class_required = Msg("Train data input requires a class variable")
169-
class_required_test = Msg("Test data input requires a class variable")
168+
class_required = Msg("Train data input requires a target variable.")
169+
too_many_classes = Msg("Too many target variables.")
170+
class_required_test = Msg("Test data input requires a target variable.")
170171
too_many_folds = Msg("Number of folds exceeds the data size")
171172
class_inconsistent = Msg("Test and train data sets "
172-
"have different classes")
173+
"have different target variables.")
173174

174175
class Warning(OWWidget.Warning):
175176
missing_data = \
176-
Msg("Instances with unknown target values were removed from{}data")
177-
test_data_missing = Msg("Missing separate test data input")
178-
scores_not_computed = Msg("Some scores could not be computed")
177+
Msg("Instances with unknown target values were removed from{}data.")
178+
test_data_missing = Msg("Missing separate test data input.")
179+
scores_not_computed = Msg("Some scores could not be computed.")
179180
test_data_unused = Msg("Test data is present but unused. "
180181
"Select 'Test on test data' to use it.")
181182

@@ -273,11 +274,15 @@ def set_train_data(self, data):
273274
Set the input training dataset.
274275
"""
275276
self.Information.data_sampled.clear()
276-
if data and not data.domain.class_var:
277+
if data and not data.domain.class_vars:
277278
self.Error.class_required()
278279
data = None
280+
elif data and len(data.domain.class_vars) > 1:
281+
self.Error.too_many_classes()
282+
data = None
279283
else:
280284
self.Error.class_required.clear()
285+
self.Error.too_many_classes.clear()
281286

282287
if isinstance(data, SqlTable):
283288
if data.approx_len() < AUTO_DL_LIMIT:

0 commit comments

Comments
 (0)