fatf.utils.models.validation.check_model_functionality¶
-
fatf.utils.models.validation.check_model_functionality(model_object: Union[object, type], require_probabilities: bool = False, suppress_warning: bool = False) → bool[source]¶ Checks whether a model object has all the required functionality.
Examines a
model_objectand ensures that it has all the required methods with the correct number of parameters (excludingself):__init__(at least 0),fit(at least 1 for unsupervised and at least 2 for supervised models),predict(at least 1) and, if required (require_probabilities=True),predict_proba(at least 1, in which casefitrequires at least 2).- Parameters
- model_objectUnion[object, type]
A Python object (either instantiated or just an object reference) that represents a predictive model.
Changed in version 0.0.2: Added the possibility of checking functionality of non-initialised objects.
- require_probabilitiesboolean, optional (default=False)
A boolean parameter that indicates whether the model object should contain a
predict_probamethod. Defaults to False.- suppress_warningboolean, optional (default=False)
A boolean parameter that indicates whether the function should suppress its warning message. Defaults to False.
- Returns
- is_functionalboolean
A boolean variable that indicates whether the model object has all the desired functionality.
- Raises
- TypeError
The
require_probabilitiesorsuppress_warningparameter is not a boolean.
- Warns
- UserWarning
Warns about the required functionality that the model object lacks.