pyreal.RealApp.produce_similar_examples#
- RealApp.produce_similar_examples(x_orig, model_id=None, x_train_orig=None, y_train=None, format_output=True, num_examples=3, standardize=False, fast=True, format_y=True, algorithm=None, force_refit=False)[source]#
Produce a SimilarExamples explainer
- Parameters:
x_orig (DataFrame) – Input to explain
model_id (string or int) – ID of model to explain
x_train_orig (DataFrame) – Data to fit on, if not provided during initialization
y_train (DataFrame or Series) – Training targets to fit on, if not provided during initialization
format_output (Boolean) – No functionality, included for consistency
num_examples (int) – Number of similar examples to return
standardize (Boolean) – If True, standardize data before using it to get similar examples. Recommended if model-ready data is not already standardized
fast (Boolean) – If True, use a faster algorithm for generating similar examples. Disable if faiss is not available
format_y (Boolean) – If True, format the ground truth y values returned using self.pred_format_func
algorithm (string) – Name of algorithm
force_refit (Boolean) – If True, initialize and fit a new explainer even if the appropriate explainer already exists
- Returns:
- DataFrame, “y”: Series, “Input”: Series} (if series),
else {“id” -> {“X”: DataFrame, “y”: Series, “Input”: Series}}
X is the examples, ordered from top to bottom by similarity to input and y is the corresponding y values Input is the original input in the same feature space
- Return type:
{“X”