API

This is the full API documentation of the sharp package.

sharp.ShaRP([qoi, target_function, measure, ...])

Explains the contributions of features to different aspects of a ranked outcome, based on Shapley values.

sharp.qoi

Quantities of interest.

qoi.DiffQoI([target_function, X])

A general QoI, suitable for models/methods that output label predictions or scores.

qoi.FlipQoI([target_function, X])

Implements equation 4 from [R152a90246262-1].

qoi.LikelihoodQoI([target_function, X])

Implements equation 3 from [R383c5c9d41a2-1].

qoi.RankQoI([target_function, X])

Rank specific QoI.

qoi.RankScoreQoI([target_function, X])

A general, ranking-oriented QoI, similar to DiffQoI.

qoi.TopKQoI([target_function, top_k, X])

Rank-specific QoI.

qoi.get_qoi(qoi)

Get a quantity of interest from string.

qoi.get_qoi_names()

Get the names of all available quantities of interest.

sharp.visualization

Visualization functions based on matplotlib.

visualization.waterfall(xai, idx[, ...])

sharp.utils

Utility functions used to check variable types, convert scores to rankings, etc.

utils.check_feature_names(X)

Retrieve feature names from X.

utils.check_inputs(X[, y])

Converts X and y inputs to numpy arrays.

utils.check_measure(measure)

If None, return a default function.

utils.check_qoi(qoi[, target_function, X])

If None, return a default function.

utils.scores_to_ordering(y[, direction])

Converts an array with scores to a ranking.