# Buggy code
def check_results_adequacy(results, error_group, check_nan=True):
    error_group.add_message("invalid_results")
    error_group.invalid_results.clear()

    def anynan(a):
        return np.any(np.isnan(a))

    if results is None:
        return None
    if results.data is None:
        error_group.invalid_results("Results do not include information on test data")
    elif not results.data.domain.has_discrete_class:
        error_group.invalid_results("Discrete outcome variable is required")
    elif check_nan and (
        anynan(results.actual)
        or anynan(results.predicted)
        or (results.probabilities is not None and anynan(results.probabilities))
    ):
        error_group.invalid_results("Results contains invalid values")
    else:
        return results


# Traceback (ValueError)
Traceback (most recent call last):
File "/Users/ajda/orange/orange-canvas-core/orangecanvas/scheme/signalmanager.py", line 718, in __process_next
self.process_queued()
File "/Users/ajda/orange/orange-canvas-core/orangecanvas/scheme/signalmanager.py", line 476, in process_queued
self.process_node(node_update_front[0])
File "/Users/ajda/orange/orange-canvas-core/orangecanvas/scheme/signalmanager.py", line 523, in process_node
self.send_to_node(node, signals_in)
File "/Users/ajda/orange/orange-widget-base/orangewidget/workflow/widgetsscheme.py", line 775, in send_to_node
self.process_signals_for_widget(node, widget, signals)
File "/Users/ajda/orange/orange-widget-base/orangewidget/workflow/widgetsscheme.py", line 816, in process_signals_for_widget
widget.handleNewSignals()
File "/Users/ajda/orange/orange3/Orange/widgets/evaluate/owpredictions.py", line 216, in handleNewSignals
self._call_predictors()
File "/Users/ajda/orange/orange3/Orange/widgets/evaluate/owpredictions.py", line 268, in _call_predictors
pred = predictor.backmap_value(pred, prob, n_values, backmappers)
File "/Users/ajda/orange/orange3/Orange/base.py", line 265, in backmap_value
value[nans] = np.argmax(mapped_probs[nans], axis=1)
File "/Users/ajda/miniconda3/envs/o3/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 1103, in argmax
return _wrapfunc(a, 'argmax', axis=axis, out=out)
File "/Users/ajda/miniconda3/envs/o3/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 56, in _wrapfunc
return getattr(obj, method)(*args, **kwds)
ValueError: attempt to get argmax of an empty sequence

# Fixed code
def check_results_adequacy(results, error_group, check_nan=True):
    error_group.add_message("invalid_results")
    error_group.invalid_results.clear()

    def anynan(a):
        return np.any(np.isnan(a))

    if results is None:
        return None
    if results.data is None:
        error_group.invalid_results("Results do not include information on test data")
    elif not results.data.domain.has_discrete_class:
        error_group.invalid_results("Discrete outcome variable is required")
    elif not results.actual.size:
        error_group.invalid_results("Empty result on input. Nothing to display.")
    elif check_nan and (
        anynan(results.actual)
        or anynan(results.predicted)
        or (results.probabilities is not None and anynan(results.probabilities))
    ):
        error_group.invalid_results("Results contains invalid values")
    else:
        return results