alibi.tests.utils module

class alibi.tests.utils.MockPredictor(out_dim, out_type='proba', model_type=None, seed=None)[source]

Bases: object

A class the mimicks the output of a classifier or regressor to allow testing of functionality that depends on it without inference overhead.

__init__(out_dim, out_type='proba', model_type=None, seed=None)[source]
  • out_dim (int) – The number of output classes.

  • out_type (str) – Indicates if probabilities, class predictions or continuous outputs are generated.

Return type


predict(*args, **kwargs)[source]
alibi.tests.utils.assert_message_in_logs(msg, records)[source]

Helper function to check if a msg is present in any of the records (an iterable of strings).

alibi.tests.utils.issorted(arr, reverse=False)[source]

Checks if a numpy array is sorted.


A context manager used to check that ExpectedException does not occur during testing.