scanvi_explainer.scanvi_deep.SCANVIDeep#
- class scanvi_explainer.scanvi_deep.SCANVIDeep(model: SCANVI, train_size: float = 0.8, batch_size: int = 128)#
SCANVIDeep is an extension of DeepExplainer [Lundberg and Lee, 2017] for models trained using SCANVI [Xu et al., 2021].
- Parameters:
Explainer – Main Explainer class from shap package
- __init__(model: SCANVI, train_size: float = 0.8, batch_size: int = 128)#
Constructor setting up expected values.
Currently categorical not continuous covariates are not supported.
Methods
__init__(model[, train_size, batch_size])Constructor setting up expected values.
add_handles(model, forward_handle, ...)Add handles to all non-container layers in the model.
add_target_handle(layer)explain_row(*row_args, max_evals, ...)Explains a single row and returns the tuple (row_values, row_expected_values, row_mask_shapes, main_effects).
get_train_test()gradient(idx, input_x, input_batch)load(in_file[, model_loader, masker_loader, ...])Load an Explainer from the given file stream.
memory_stats()Helper function to track CUDA memory usage.
remove_attributes(model)Removes the x and y attributes which were added by the forward handles Recursively searches for non-container layers
save(out_file[, model_saver, masker_saver])Write the explainer to the given file stream.
shap_values([with_labels])Estimate SHAP values
supports_model_with_masker(model, masker)Determines if this explainer can handle the given model.