omnixai.explainers.ranking.agnostic package
Ranking Explainer for tabular data. |
|
Feature Permutation Ranking Explainer for tabular data. |
omnixai.explainers.ranking.agnostic.validity module
Ranking Explainer for tabular data.
- class omnixai.explainers.ranking.agnostic.validity.ValidityRankingExplainer(training_data, predict_function, ignored_features=None, **kwargs)
Bases:
ExplainerBaseRanking Explainer for Tabular Data. If using this explainer, please cite the paper Extracting per Query Valid Explanations for Blackbox Learning-to-Rank Models, https://dl.acm.org/doi/10.1145/3471158.3472241.
- Parameters
training_data (
Tabular) – The data used to initialize a Ranking explainer.training_datacan be the training dataset for training the machine learning model.predict_function (
Callable) – The prediction function corresponding to the model to explain. the outputs of thepredict_functionare the ranking scores. The output must be a numpy array.ignored_features (
Optional[List]) – The features ignored by the valid per-query algorithm.
- explanation_type = 'local'
- alias = ['validity']
- explain(X, k=3, n_items=None, mask='median', weighted=False, epsilon=-1.0, query_id=None, verbose=False, **kwargs)
Generates the valid per-query feature-importance explanations for the input instances.
- Parameters
X (
Tabular) – A set of input items for a query.k (
int) – The maximum number of features to be accounted as explanationn_items (
Optional[int]) – The number of items to be considered for the explanationmask (
str) – The type of feature masking to be performed (median, mode, None) default=medianweighted (
bool) – Flag for calculating weighted propensityepsilon (
float) – The epsilon value for the greedy-cover procedure. Negative epsilon will replace greedy-cover with simple greedyquery_id (
Optional[str]) – The feature column representing the query_id if presentverbose (
bool) – Flag for verbosity of print statements
- Return type
- Returns
The valid per-query feature-importance explanations for the given items.
omnixai.explainers.ranking.agnostic.permutation module
Feature Permutation Ranking Explainer for tabular data.
- class omnixai.explainers.ranking.agnostic.permutation.PermutationRankingExplainer(training_data, predict_function, ignored_features=None, random_state=None, **kwargs)
Bases:
ExplainerBaseFeature Permutation Ranking Explainer for Tabular Data.
- Parameters
training_data (
Tabular) – The data used to initialize a Ranking explainer.training_datacan be the training dataset for training the machine learning model.predict_function (
Callable) – The prediction function corresponding to the model to explain. the outputs of thepredict_functionare the ranking scores. The output must be a numpy array.ignored_features (
Optional[List]) – The features ignored by the permutation per-query algorithm.
- explanation_type = 'local'
- alias = ['permutation']
- explain(X, n_items=None, weighted=False, quotient=False, query_id=None, n_iter=100, verbose=False, **kwargs)
Generates the permutation based per-query feature-importance explanations for the input instances.
- Parameters
X (
Tabular) – A set of input items for a query.n_items (
Optional[int]) – The number of items to be considered for the explanationweighted (
bool) – Flag for calculating weighted propensityquotient (
bool) – Flag for propensity normalizationquery_id (
Optional[str]) – The feature column representing the query_id if presentn_iter (
int) – The number of iterations to run for each feature permutation. Higher is more stable.verbose (
bool) – Flag for verbosity of print statements
- Return type
- Returns
The per-query feature-importance explanations for the given items.