(feature_id, input_data, estimator_fn,
                               original_predictions, feature_info,
                               feature_names, training_labels=None,
                               method='prediction-variance',
                               scaled=False, scorer=None)
return {feature_id: importance}
Global function for computing column-wise importance

    Parameters
    ----------
    feature_id: hashable
        which feature for which to compute importance
    input_data:
        training data (or sample)
    estimator_fn: callable
        prediction function
    original_predictions: array type
        predicted values before perturbation
    feature_info: dict
        from skater.data.DataManager.feature_info
    feature_names: array type
        list of feature names
    training_labels: array type
        ground truth labels. only required if method="perfomance decrease"
    method: string
        prediction-variance: importance based on changes in predictions caused by
                             changing values of the feature space.
        model-scoring:       importance based on differences in prediction scores/cost
                             functions caused by changing values of the feature space.
    model_type: string
        regression or classification
    scaled: bool
        Whether to weight the importance values by the stregth of the perturbations.

    Returns
    ----------
    importance: dict
        {feature id: importance value}
Global function for computing column-wise importance
Global function for computing column - wise importance
def compute_feature_importance(feature_id, input_data, estimator_fn,
                               original_predictions, feature_info,
                               feature_names, training_labels=None,
                               method='prediction-variance',
                               scaled=False, scorer=None):
    """Global function for computing column-wise importance

    Parameters
    ----------
    feature_id: hashable
        which feature for which to compute importance
    input_data:
        training data (or sample)
    estimator_fn: callable
        prediction function
    original_predictions: array type
        predicted values before perturbation
    feature_info: dict
        from skater.data.DataManager.feature_info
    feature_names: array type
        list of feature names
    training_labels: array type
        ground truth labels. only required if method="perfomance decrease"
    method: string
        prediction-variance: importance based on changes in predictions caused by
                             changing values of the feature space.
        model-scoring:       importance based on differences in prediction scores/cost
                             functions caused by changing values of the feature space.
    model_type: string
        regression or classification
    scaled: bool
        Whether to weight the importance values by the stregth of the perturbations.

    Returns
    ----------
    importance: dict
        {feature id: importance value}
    """

    copy_of_data_set = DataManager(input_data.copy(), feature_names=feature_names)
    n = copy_of_data_set.n_rows

    original_values = copy_of_data_set[feature_id]

    # collect perturbations
    if feature_info[feature_id]['numeric']:
        samples = copy_of_data_set.generate_column_sample(feature_id, n_samples=n,
                                                          strategy='uniform-over-similarity-ranks')
    else:
        samples = copy_of_data_set.generate_column_sample(feature_id, n_samples=n, strategy='random-choice')


    copy_of_data_set[feature_id] = samples.reshape(-1)

    if copy_of_data_set.data_type == np.ndarray:
        new_predictions = estimator_fn(copy_of_data_set.values)
    else:
        new_predictions = estimator_fn(copy_of_data_set.X)

    importance = compute_importance(new_predictions,
                                    original_predictions,
                                    original_values,
                                    samples,
                                    training_labels,
                                    method=method,
                                    scaled=scaled,
                                    scorer=scorer)
    return {feature_id: importance}
def compute_feature_importance ( feature_id , input_data , estimator_fn , original_predictions , feature_info , feature_names , training_labels = None , method = 'prediction-variance' , scaled = False , scorer = None ) : copy_of_data_set = DataManager ( input_data . copy ( ) , feature_names = feature_names ) n = copy_of_data_set . n_rows original_values = copy_of_data_set [ feature_id ] # collect perturbations if feature_info [ feature_id ] [ 'numeric' ] : samples = copy_of_data_set . generate_column_sample ( feature_id , n_samples = n , strategy = 'uniform-over-similarity-ranks' ) else : samples = copy_of_data_set . generate_column_sample ( feature_id , n_samples = n , strategy = 'random-choice' ) copy_of_data_set [ feature_id ] = samples . reshape ( - 1 ) if copy_of_data_set . data_type == np . ndarray : new_predictions = estimator_fn ( copy_of_data_set . values ) else : new_predictions = estimator_fn ( copy_of_data_set . X ) importance = compute_importance ( new_predictions , original_predictions , original_values , samples , training_labels , method = method , scaled = scaled , scorer = scorer ) return { feature_id : importance }