rise_image
Module Contents
Classes
RISE implementation for images based on https://github.com/eclique/RISE/blob/master/Easy_start.ipynb. |
- class rise_image.RISEImage(n_masks=1000, feature_res=8, p_keep=None, axis_labels=None, preprocess_function=None)[source]
RISE implementation for images based on https://github.com/eclique/RISE/blob/master/Easy_start.ipynb.
- explain(model_or_function, input_data, labels, batch_size=100)[source]
Runs the RISE explainer on images.
The model will be called with masked images, with a shape defined by batch_size and the shape of input_data.
- Parameters:
- Returns:
Explanation heatmap for each class (np.ndarray).
- _prepare_input_data_and_model(input_data, model_or_function)[source]
Prepares the input data as an xarray with an added batch dimension and creates a preprocessing function.
- _determine_p_keep(input_data, runner, n_masks=100)[source]
See n_mask default value https://github.com/dianna-ai/dianna/issues/24#issuecomment-1000152233.
- _prepare_image_data(input_data)[source]
Transforms the data to be of the shape and type RISE expects.
- Parameters:
input_data (xarray) – Data to be explained
- Returns:
transformed input data, preprocessing function to use with utils.get_function()