sharp.qoi.FlipQoI

class sharp.qoi.FlipQoI(target_function=None, X=None)[source]

Implements equation 4 from [1]. This QoI is designed for classification, using label predictions. Although it was originally intended for binary classification, multiclass problems may be quantified directly using this QoI. This QoI’s influence score quantifies how “pivotal” a given feature is. target_function should output class predictions.

Notes

This QoI was formerly defined as BCFlipped.

References

[1]

Datta, A., Sen, S., & Zick, Y. (2016). Algorithmic transparency via quantitative input influence: Theory and experiments with learning systems. In 2016 IEEE symposium on security and privacy (SP) (pp. 598-617). IEEE.

Methods

calculate(rows1, rows2)

Calculates the influence score based on the target_function outputs for rows1 and rows2.

estimate(rows)

Prepares and runs self.target_function for a set of samples.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

set_params(**params)

Set the parameters of this estimator.


calculate(rows1, rows2)

Calculates the influence score based on the target_function outputs for rows1 and rows2.

Parameters:
rows1array-like of shape (n_samples, n_features)

First set of samples to compare.

rows2array-like of shape (n_samples, n_features)

Second set of samples to compare.

Returns:
influence_scorefloat

Influence score for rows1, compared to rows2.

estimate(rows)

Prepares and runs self.target_function for a set of samples.

Parameters:
rowsarray-like of shape (n_samples, n_features)

Samples over which target_function will be applied.

Returns:
target_outputnp.ndarray of shape (n_samples,)

Label predictions or score estimations.

get_metadata_routing()

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Returns:
routingMetadataRequest

A MetadataRequest encapsulating routing information.

get_params(deep=True)

Get parameters for this estimator.

Parameters:
deepbool, default=True

If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:
paramsdict

Parameter names mapped to their values.

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Parameters:
**paramsdict

Estimator parameters.

Returns:
selfestimator instance

Estimator instance.