shapiq.utils.safe_isinstance¶
- shapiq.utils.safe_isinstance(obj, class_path_str)[source]¶
Safely checks if an object is an instance of a class.
Acts as a safe version of isinstance without having to explicitly import packages which may not exist in the user’s environment. Checks if obj is an instance of type specified by class_path_str.
Note
This function was directly taken from the shap repository.
- Parameters:
- Return type:
- Returns:
True if isinstance is true and the package exists, False otherwise