(new_predictions, original_predictions,
                                                original_x, perturbed_x, scaled=True)
return importance
Mean absolute change in predictions given perturbations in a feature
Mean absolute change in predictions given perturbations in a feature
Mean absolute change in predictions given perturbations in a feature
def _compute_importance_via_prediction_variance(new_predictions, original_predictions,
                                                original_x, perturbed_x, scaled=True):
    """Mean absolute change in predictions given perturbations in a feature"""
    changes_in_predictions = abs(new_predictions - original_predictions)
    if len(changes_in_predictions.shape) == 1:
        changes_in_predictions = changes_in_predictions[:, np.newaxis]

    if scaled:
        scales = importance_scaler(original_x, perturbed_x)
        changes_in_predictions = np.sum(changes_in_predictions, axis=1) * scales

    importance = np.mean(changes_in_predictions)
    return importance
def _compute_importance_via_prediction_variance ( new_predictions , original_predictions , original_x , perturbed_x , scaled = True ) : changes_in_predictions = abs ( new_predictions - original_predictions ) if len ( changes_in_predictions . shape ) == 1 : changes_in_predictions = changes_in_predictions [ : , np . newaxis ] if scaled : scales = importance_scaler ( original_x , perturbed_x ) changes_in_predictions = np . sum ( changes_in_predictions , axis = 1 ) * scales importance = np . mean ( changes_in_predictions ) return importance