@@ -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