(new_predictions, original_predictions, training_labels,
                                          original_x, perturbed_x, scorer, scaled=True)
return abs(max((score2 - score1) * multiple, 0))
Mean absolute error of predictions given perturbations in a feature
Mean absolute error of predictions given perturbations in a feature
Mean absolute error of predictions given perturbations in a feature
def _compute_importance_via_model_scoring(new_predictions, original_predictions, training_labels,
                                          original_x, perturbed_x, scorer, scaled=True):

    """Mean absolute error of predictions given perturbations in a feature"""
    if scaled:
        sample_weight = importance_scaler(original_x, perturbed_x)
    else:
        sample_weight = None

    score1 = scorer(training_labels, new_predictions, sample_weight=sample_weight)
    score2 = scorer(training_labels, original_predictions, sample_weight=sample_weight)
    multiple = 1 if scorer.type == StaticTypes.scorer_types.increasing else -1
    return abs(max((score2 - score1) * multiple, 0))
def _compute_importance_via_model_scoring ( new_predictions , original_predictions , training_labels , original_x , perturbed_x , scorer , scaled = True ) : if scaled : sample_weight = importance_scaler ( original_x , perturbed_x ) else : sample_weight = None score1 = scorer ( training_labels , new_predictions , sample_weight = sample_weight ) score2 = scorer ( training_labels , original_predictions , sample_weight = sample_weight ) multiple = 1 if scorer . type == StaticTypes . scorer_types . increasing else - 1 return abs ( max ( ( score2 - score1 ) * multiple , 0 ) )